1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace BitBag\SyliusBraintreePlugin\Reply\Api; |
6
|
|
|
|
7
|
|
|
use BitBag\SyliusBraintreePlugin\Util\ArrayUtils; |
8
|
|
|
use Braintree\Transaction; |
9
|
|
|
|
10
|
|
|
final class TransactionArray |
11
|
|
|
{ |
12
|
|
|
public static function toArray(Transaction $object): array |
13
|
|
|
{ |
14
|
|
|
if (null === $object) { |
15
|
|
|
return []; |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
$array = ArrayUtils::extractPropertiesToArray($object, [ |
19
|
|
|
'id', 'status', 'type', 'currentIsoCode', 'amount', |
20
|
|
|
'merchantAccountId', 'subMerchantAccountId', 'masterMerchantAccountId', |
21
|
|
|
'orderId', 'createdAt', 'updatedAt', 'customer', 'billing', 'refundId', |
22
|
|
|
'refundIds', 'refundedTransactionId', 'partialSettlementTransactionIds', |
23
|
|
|
'authorizedTransactionId', 'settlementBatchId', 'shipping', 'customFields', |
24
|
|
|
'avsErrorResponseCode', 'avsPostalCodeResponseCode', 'avsStreetAddressResponseCode', |
25
|
|
|
'cvvResponseCode', 'gatewayRejectionReason', 'processorAuthorizationCode', |
26
|
|
|
'processorResponseCode', 'processorResponseText', 'additionalProcessorResponse', |
27
|
|
|
'voiceReferralNumber', 'purchaseOrderNumber', 'taxAmount', 'taxExempt', 'creditCard', |
28
|
|
|
'planId', 'subscriptionId', 'subscription', 'addOns', 'discounts', 'recurring', |
29
|
|
|
'channel', 'serviceFeeAmount', 'escrowStatus', /*disbursementDetails,*/ |
30
|
|
|
'paymentInstrumentType', 'processorSettlementResponseCode', |
31
|
|
|
'processorSettlementResponseText', 'threeDSecureInfo', /*, creditCardDetails */ |
32
|
|
|
]); |
33
|
|
|
|
34
|
|
|
return $array; |
35
|
|
|
} |
36
|
|
|
} |
37
|
|
|
|