PurchaseRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
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 23
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 15 1
A sendData() 0 4 1
1
<?php
2
/**
3
 * OKPAY driver for Omnipay PHP payment library.
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-okpay
6
 * @package   omnipay-okpay
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\OKPAY\Message;
12
13
class PurchaseRequest extends AbstractRequest
14
{
15 3
    public function getData()
16
    {
17 3
        $this->validate('purse', 'currency', 'amount', 'description');
18
        return [
19
            'ok_receiver' => $this->getPurse(),
20 3
            'ok_item_1_name' => $this->getDescription(),
21 3
            'ok_currency' => $this->getCurrency(),
22 3
            'ok_item_1_price' => $this->getAmount(),
23 3
            'ok_invoice' => $this->getTransactionId(),
24 3
            'ok_ipn' => $this->getNotifyUrl(),
25 3
            'ok_return_success' => $this->getReturnUrl(),
26 3
            'ok_return_fail' => $this->getCancelUrl(),
27 3
            'ok_fees' => $this->getFees(),
28 3
        ];
29 3
    }
30
31
    public function sendData($data)
32 2
    {
33
        return $this->response = new PurchaseResponse($this, $data, $this->getEndpoint());
34 2
    }
35
}
36