setCardCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use CommerceGuys\AuthNet\Request\RequestInterface;
6
7
/**
8
 * Verifies an existing customer payment profile.
9
 *
10
 * @link http://developer.authorize.net/api/reference/index.html#customer-profiles-validate-customer-payment-profile
11
 */
12
class ValidateCustomerPaymentProfileRequest extends BaseApiRequest
13
{
14
    protected $customerProfileId;
15
    protected $customerPaymentProfileId;
16
    protected $customerShippingAddressId;
17
    protected $cardCode;
18
    protected $validationMode = 'testMode';
19
20
    /**
21
     * @param mixed $customerProfileId
22
     */
23 1
    public function setCustomerProfileId($customerProfileId)
24
    {
25 1
        $this->customerProfileId = $customerProfileId;
26 1
    }
27
28
    /**
29
     * @param mixed $customerPaymentProfileId
30
     */
31 1
    public function setCustomerPaymentProfileId($customerPaymentProfileId)
32
    {
33 1
        $this->customerPaymentProfileId = $customerPaymentProfileId;
34 1
    }
35
36
    /**
37
     * @param mixed $customerShippingAddressId
38
     */
39
    public function setCustomerShippingAddressId($customerShippingAddressId)
40
    {
41
        $this->customerShippingAddressId = $customerShippingAddressId;
42
    }
43
44
    /**
45
     * @param mixed $cardCode
46
     */
47
    public function setCardCode($cardCode)
48
    {
49
        $this->cardCode = $cardCode;
50
    }
51
52
    public function setValidationMode($validationMode)
53
    {
54
        $this->validationMode = $validationMode;
55
    }
56
57 1
    protected function attachData(RequestInterface $request)
58
    {
59 1
        $request->addData('customerProfileId', $this->customerProfileId);
60 1
        $request->addData('customerPaymentProfileId', $this->customerPaymentProfileId);
61
62 1
        if (isset($this->customerShippingAddressId)) {
63
            $request->addData('customerShippingAddressId', $this->customerShippingAddressId);
64
        }
65 1
        if (isset($this->cardCode)) {
66
            $request->addData('cardCode', $this->cardCode);
67
        }
68 1
        $request->addData('validationMode', $this->validationMode);
69 1
    }
70
}
71