6
6
7
7
namespace Mollie \Payment \Block \Info ;
8
8
9
+ use Exception ;
9
10
use Magento \Framework \Pricing \PriceCurrencyInterface ;
10
11
use Magento \Framework \Registry ;
11
- use Magento \Payment \Block \Info ;
12
- use Magento \Framework \View \Element \Template \Context ;
13
12
use Magento \Framework \Stdlib \DateTime ;
13
+ use Magento \Framework \View \Element \Template \Context ;
14
+ use Magento \Payment \Block \Info ;
14
15
use Magento \Sales \Api \Data \OrderInterface ;
15
16
use Mollie \Payment \Config ;
16
17
use Mollie \Payment \Helper \General as MollieHelper ;
@@ -75,7 +76,7 @@ public function getCheckoutType(): ?string
75
76
{
76
77
try {
77
78
return $ this ->getInfo ()->getAdditionalInformation ('checkout_type ' );
78
- } catch (\ Exception $ e ) {
79
+ } catch (Exception $ e ) {
79
80
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
80
81
return null ;
81
82
}
@@ -87,7 +88,7 @@ public function getExpiresAt(): ?string
87
88
if ($ expiresAt = $ this ->getInfo ()->getAdditionalInformation ('expires_at ' )) {
88
89
return $ this ->timezone ->date ($ expiresAt )->format (DateTime::DATETIME_PHP_FORMAT );
89
90
}
90
- } catch (\ Exception $ e ) {
91
+ } catch (Exception $ e ) {
91
92
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
92
93
}
93
94
@@ -116,7 +117,7 @@ public function getCheckoutUrl(): ?string
116
117
{
117
118
try {
118
119
return $ this ->getInfo ()->getAdditionalInformation ('checkout_url ' );
119
- } catch (\ Exception $ e ) {
120
+ } catch (Exception $ e ) {
120
121
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
121
122
return null ;
122
123
}
@@ -126,7 +127,7 @@ public function getPaymentStatus(): ?string
126
127
{
127
128
try {
128
129
return $ this ->getInfo ()->getAdditionalInformation ('payment_status ' );
129
- } catch (\ Exception $ e ) {
130
+ } catch (Exception $ e ) {
130
131
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
131
132
return null ;
132
133
}
@@ -136,7 +137,26 @@ public function getDashboardUrl(): ?string
136
137
{
137
138
try {
138
139
return $ this ->getInfo ()->getAdditionalInformation ('dashboard_url ' );
139
- } catch (\Exception $ e ) {
140
+ } catch (Exception $ e ) {
141
+ $ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
142
+ return null ;
143
+ }
144
+ }
145
+
146
+ public function getPayPalReference (): ?string
147
+ {
148
+ try {
149
+ $ details = $ this ->getInfo ()->getAdditionalInformation ('details ' );
150
+ if (is_string ($ details )) {
151
+ $ details = json_decode ($ details , true );
152
+ }
153
+
154
+ if (!is_array ($ details ) || !array_key_exists ('paypalReference ' , $ details )) {
155
+ return null ;
156
+ }
157
+
158
+ return $ details ['paypalReference ' ];
159
+ } catch (Exception $ e ) {
140
160
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
141
161
return null ;
142
162
}
@@ -146,7 +166,7 @@ public function getChangePaymentStatusUrl(): ?string
146
166
{
147
167
try {
148
168
return (string )$ this ->getInfo ()->getAdditionalInformation ('mollie_change_payment_state_url ' );
149
- } catch (\ Exception $ exception ) {
169
+ } catch (Exception $ exception ) {
150
170
return null ;
151
171
}
152
172
}
@@ -155,7 +175,7 @@ public function getMollieId(): ?string
155
175
{
156
176
try {
157
177
return $ this ->getInfo ()->getAdditionalInformation ('mollie_id ' );
158
- } catch (\ Exception $ e ) {
178
+ } catch (Exception $ e ) {
159
179
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
160
180
return null ;
161
181
}
@@ -181,7 +201,7 @@ public function isBuyNowPayLaterMethod(): bool
181
201
if (in_array ($ code , $ methods )) {
182
202
return true ;
183
203
}
184
- } catch (\ Exception $ e ) {
204
+ } catch (Exception $ e ) {
185
205
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
186
206
}
187
207
@@ -205,7 +225,7 @@ public function getOrderId(): ?string
205
225
{
206
226
try {
207
227
return $ this ->getInfo ()->getParentId ();
208
- } catch (\ Exception $ e ) {
228
+ } catch (Exception $ e ) {
209
229
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
210
230
return null ;
211
231
}
@@ -224,7 +244,7 @@ public function getRemainderAmount()
224
244
{
225
245
try {
226
246
return $ this ->getInfo ()->getAdditionalInformation ('remainder_amount ' );
227
- } catch (\ Exception $ e ) {
247
+ } catch (Exception $ e ) {
228
248
$ this ->mollieHelper ->addTolog ('error ' , $ e ->getMessage ());
229
249
}
230
250
0 commit comments