PurchaseRequest::sendData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
ccs 1
cts 1
cp 1
crap 1
1
<?php
2
3
/*
4
 * eCoin driver for Omnipay PHP payment library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-ecoin
7
 * @package   omnipay-ecoin
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\eCoin\Message;
13
14
class PurchaseRequest extends AbstractRequest
15 3
{
16
    public function getData()
17 3
    {
18 3
        $this->validate(
19 3
            'purse',
20 3
            'amount', 'currency', 'description',
21
            'returnUrl', 'cancelUrl', 'notifyUrl'
22
        );
23
24 3
        return [
25 3
            'ECM_PURCH_DESC'  => $this->getDescription(),
26 3
            'ECM_INV_NO'      => $this->getTransactionId(),
27 3
            'ECM_PAYEE_ID'    => $this->getPurse(),
28 3
            'ECM_ITEM_COST'   => $this->getAmount(),
29 3
            'ECM_QTY'         => '1',
30 3
            'ECM_RESULT_URL'  => $this->getNotifyUrl(),
31 3
            'ECM_SUCCESS_URL' => $this->getReturnUrl(),
32
            'ECM_FAIL_URL'    => $this->getCancelUrl(),
33
        ];
34
    }
35 2
36
    public function sendData($data)
37 2
    {
38
        return $this->response = new PurchaseResponse($this, $data);
39
    }
40
}
41