Skip to content

Commit 75519b6

Browse files
committed
PRE-3054 fix: hostedFields url + object retrieve
1 parent 6156046 commit 75519b6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/Payplug/Core/APIRoutes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public static function setHostedFieldsResource($hostedFieldsUrl){
121121
* @return void
122122
*/
123123
public static function setHostedFieldsResourceRetrieve($hostedFieldsRetrieveUrl){
124-
self::$HOSTED_FIELDS_RESOURCE = $hostedFieldsRetrieveUrl;
124+
self::$HOSTED_FIELDS_RESOURCE_RETRIEVE = $hostedFieldsRetrieveUrl;
125125
}
126126

127127
/**

lib/Payplug/Responses/HostedFieldTransactionResource.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ class HostedFieldTransactionResource
5252

5353
public function __construct($data = [])
5454
{
55+
// Accept raw JSON string
56+
if (is_string($data)) {
57+
$decoded = json_decode($data, true);
58+
if (json_last_error() === JSON_ERROR_NONE) {
59+
$data = $decoded;
60+
}
61+
}
5562
if (empty($data) || !is_array($data)) {
5663
return;
5764
}
@@ -63,10 +70,11 @@ public function __construct($data = [])
6370
$this->currency = !empty($payment_data['CURRENCY']) ? $payment_data['CURRENCY'] : 'EUR';
6471
$this->created_at = !empty($payment_data['DATE']) ? $payment_data['DATE'] : null;
6572
$this->description = !empty($payment_data['DESCRIPTION']) ? $payment_data['DESCRIPTION'] : '';
66-
$this->is_paid = !empty($payment_data['DATE']) ? $payment_data['DATE'] : false;
73+
$this->is_paid = $data['EXECCODE']=='0000';
6774
$this->paid_at = !empty($payment_data['DATE']) ? $payment_data['DATE'] : null;
6875
$this->is_3ds = !empty($payment_data['3DSECURE']) ? $payment_data['3DSECURE'] : false;
6976
$this->card = [
77+
'id'=> null,
7078
'last4' => null,
7179
'exp_month' => null,
7280
'exp_year' => null,

0 commit comments

Comments
 (0)