1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WSW\SiftScience\Transformers; |
4
|
|
|
|
5
|
|
|
use WSW\Email\Email; |
6
|
|
|
use WSW\SiftScience\Entities\PaymentMethod; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class PaymentMethodTransformer |
10
|
|
|
* |
11
|
|
|
* @package WSW\SiftScience\Transformers |
12
|
|
|
* @author Ronaldo Matos Rodrigues <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class PaymentMethodTransformer extends AbstractTransformer |
15
|
|
|
{ |
16
|
|
|
public function transform(PaymentMethod $paymentMethod) |
17
|
|
|
{ |
18
|
|
|
return array_filter([ |
19
|
|
|
'$payment_type' => $paymentMethod->getPaymentType(), |
20
|
|
|
'$payment_gateway' => $paymentMethod->getPaymentGateway(), |
21
|
|
|
'$card_bin' => $paymentMethod->getCardBin(), |
22
|
|
|
'$card_last4' => $paymentMethod->getCardLast4(), |
23
|
|
|
'$avs_result_code' => $paymentMethod->getAvsResultCode(), |
24
|
|
|
'$cvv_result_code' => $paymentMethod->getCvvResultCode(), |
25
|
|
|
'$verification_status' => $paymentMethod->getVerificationStatus(), |
26
|
|
|
'$routing_number' => $paymentMethod->getRoutingNumber(), |
27
|
|
|
'$decline_reason_code' => $paymentMethod->getDeclineReasonCode(), |
28
|
|
|
'$paypal_payer_id' => $paymentMethod->getPaypalPayerId(), |
29
|
|
|
'$paypal_payer_email' => (!$paymentMethod->getPaypalPayerEmail() instanceof Email) |
30
|
|
|
? null |
31
|
|
|
: $paymentMethod->getPaypalPayerEmail()->getEmail(), |
32
|
|
|
'$paypal_payer_status' => $paymentMethod->getPaypalPayerStatus(), |
33
|
|
|
'$paypal_address_status' => $paymentMethod->getPaypalAddressStatus(), |
34
|
|
|
'$paypal_protection_eligibility' => $paymentMethod->getPaypalProtectionEligibility(), |
35
|
|
|
'$paypal_payment_status' => $paymentMethod->getPaypalPaymentStatus(), |
36
|
|
|
'$stripe_cvc_check' => $paymentMethod->getStripeCvcCheck(), |
37
|
|
|
'$stripe_address_line1_check' => $paymentMethod->getStripeAddressLine1Check(), |
38
|
|
|
'$stripe_address_line2_check' => $paymentMethod->getStripeAddressLine2Check(), |
39
|
|
|
'$stripe_address_zip_check' => $paymentMethod->getStripeAddressZipCheck(), |
40
|
|
|
'$stripe_funding' => $paymentMethod->getStripeFunding(), |
41
|
|
|
'$stripe_brand' => $paymentMethod->getStripeBrand() |
42
|
|
|
]); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|