Passed
Pull Request — master (#43)
by
unknown
01:50
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use GuzzleHttp\Client;
6
use CommerceGuys\AuthNet\Request\RequestInterface;
7
8
/**
9
 * Creates a customer profile, payment profile, and shipping address
10
 * from an existing successful transaction.
11
 *
12
 * This request uses a transaction ID (`transId`) from a prior successful
13
 * payment to generate a new customer profile in Authorize.Net.
14
 *
15
 * @link https://developer.authorize.net/api/reference/index.html#customer-profiles-create-a-customer-profile-from-a-transaction
16
 */
17
class CreateCustomerProfileFromTransactionRequest extends BaseApiRequest
18
{
19
    /**
20
     * @var string The transaction ID from a successful payment.
21
     */
22
    protected $transId;
23
24
    /**
25
     * Constructs a new CreateCustomerProfileFromTransactionRequest object.
26
     *
27
     * @param Configuration $configuration
28
     *   The configuration object containing API credentials.
29
     * @param Client $client
30
     *   The HTTP client for making requests.
31
     * @param string $transId
32
     *   The transaction ID from an existing successful transaction.
33
     */
34
    public function __construct(
35
        Configuration $configuration,
36
        Client $client,
37
        $transId
38
    ) {
39
        parent::__construct($configuration, $client);
40
        $this->transId = $transId;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    protected function attachData(RequestInterface $request)
47
    {
48
        $request->addData('transId', $this->transId);
49
    }
50
}
51