Completed
Push — master ( fb0370...84a128 )
by Ronaldo
03:03
created

PaymentMethodTransformer::transform()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 28
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 0
cts 24
cp 0
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 25
nc 1
nop 1
crap 6
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