PurchaseRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 2
cbo 2
dl 0
loc 27
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 19 1
A sendData() 0 4 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