Completed
Push — master ( 0f907a...866d23 )
by Andrii
02:30
created

PurchaseRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 2
cbo 2
dl 0
loc 29
ccs 19
cts 19
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 21 1
A sendData() 0 4 1
1
<?php
2
3
/*
4
 * PayPal driver for Omnipay PHP payment library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-paypal
7
 * @package   omnipay-paypal
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\PayPal\Message;
13
14
class PurchaseRequest extends AbstractRequest
15
{
16 3
    public function getData()
17
    {
18 3
        $this->validate(
19 3
            'purse',
20 3
            'amount', 'currency', 'description',
21 3
            'returnUrl', 'cancelUrl', 'notifyUrl'
22 3
        );
23
24
        return [
25 3
            'cmd'           => '_xclick',
26 3
            'bn'            => 'PP-BuyNowBF:btn_paynowCC_LG.gif:NonHostedGuest',
27 3
            'item_name'     => $this->getDescription(),
28 3
            'amount'        => $this->getSum(),
29 3
            'currency_code' => strtoupper($this->getCurrency()),
30 3
            'business'      => $this->getPurse(),
31 3
            'notify_url'    => $this->getNotifyUrl(),
32 3
            'return'        => $this->getReturnUrl(),
33 3
            'cancel_return' => $this->getCancelUrl(),
34 3
            'item_number'   => $this->getTransactionId(),
35 3
        ];
36
    }
37
38 2
    public function sendData($data)
39
    {
40 2
        return $this->response = new PurchaseResponse($this, $data);
41
    }
42
}
43