Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Payplug/Core/APIRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static function setHostedFieldsResource($hostedFieldsUrl){
* @return void
*/
public static function setHostedFieldsResourceRetrieve($hostedFieldsRetrieveUrl){
self::$HOSTED_FIELDS_RESOURCE = $hostedFieldsRetrieveUrl;
self::$HOSTED_FIELDS_RESOURCE_RETRIEVE = $hostedFieldsRetrieveUrl;
}

/**
Expand Down
10 changes: 9 additions & 1 deletion lib/Payplug/Responses/HostedFieldTransactionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ class HostedFieldTransactionResource

public function __construct($data = [])
{
// Accept raw JSON string
if (is_string($data)) {
$decoded = json_decode($data, true);
if (json_last_error() === JSON_ERROR_NONE) {
$data = $decoded;
}
}
if (empty($data) || !is_array($data)) {
return;
}
Expand All @@ -63,10 +70,11 @@ public function __construct($data = [])
$this->currency = !empty($payment_data['CURRENCY']) ? $payment_data['CURRENCY'] : 'EUR';
$this->created_at = !empty($payment_data['DATE']) ? $payment_data['DATE'] : null;
$this->description = !empty($payment_data['DESCRIPTION']) ? $payment_data['DESCRIPTION'] : '';
$this->is_paid = !empty($payment_data['DATE']) ? $payment_data['DATE'] : false;
$this->is_paid = $data['EXECCODE']=='0000';
$this->paid_at = !empty($payment_data['DATE']) ? $payment_data['DATE'] : null;
$this->is_3ds = !empty($payment_data['3DSECURE']) ? $payment_data['3DSECURE'] : false;
$this->card = [
'id'=> null,
'last4' => null,
'exp_month' => null,
'exp_year' => null,
Expand Down
Loading