Completed
Push — master ( 84a128...7da2fe )
by Ronaldo
07:05
created

PaymentMethodTransformer::transform()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 23
nc 1
nop 1
1
<?php
2
3
namespace WSW\SiftScience\Transformers\Entities;
4
5
use WSW\SiftScience\Entities\PaymentMethod;
6
use WSW\SiftScience\Support\Traits\Transformers\ObjectValues;
7
use WSW\SiftScience\Transformers\AbstractTransformer;
8
9
/**
10
 * Class PaymentMethodTransformer
11
 *
12
 * @package WSW\SiftScience\Transformers\Entities
13
 * @author Ronaldo Matos Rodrigues <[email protected]>
14
 */
15
class PaymentMethodTransformer extends AbstractTransformer
16
{
17
    use ObjectValues;
18
19
    /**
20
     * @param PaymentMethod $paymentMethod
21
     *
22
     * @return array
23
     */
24
    public function transform(PaymentMethod $paymentMethod)
25
    {
26
        return array_filter([
27
            '$payment_type' => $paymentMethod->getPaymentType(),
28
            '$payment_gateway' => $paymentMethod->getPaymentGateway(),
29
            '$card_bin' => $paymentMethod->getCardBin(),
30
            '$card_last4' => $paymentMethod->getCardLast4(),
31
            '$avs_result_code' => $paymentMethod->getAvsResultCode(),
32
            '$cvv_result_code' => $paymentMethod->getCvvResultCode(),
33
            '$verification_status' => $paymentMethod->getVerificationStatus(),
34
            '$routing_number' => $paymentMethod->getRoutingNumber(),
35
            '$decline_reason_code' => $paymentMethod->getDeclineReasonCode(),
36
            '$paypal_payer_id' => $paymentMethod->getPaypalPayerId(),
37
            '$paypal_payer_email' => $this->email($paymentMethod->getPaypalPayerEmail()),
38
            '$paypal_payer_status' => $paymentMethod->getPaypalPayerStatus(),
39
            '$paypal_address_status' => $paymentMethod->getPaypalAddressStatus(),
40
            '$paypal_protection_eligibility' => $paymentMethod->getPaypalProtectionEligibility(),
41
            '$paypal_payment_status' => $paymentMethod->getPaypalPaymentStatus(),
42
            '$stripe_cvc_check' => $paymentMethod->getStripeCvcCheck(),
43
            '$stripe_address_line1_check' => $paymentMethod->getStripeAddressLine1Check(),
44
            '$stripe_address_line2_check' => $paymentMethod->getStripeAddressLine2Check(),
45
            '$stripe_address_zip_check' => $paymentMethod->getStripeAddressZipCheck(),
46
            '$stripe_funding' => $paymentMethod->getStripeFunding(),
47
            '$stripe_brand' => $paymentMethod->getStripeBrand()
48
        ]);
49
    }
50
}
51