RefundRequest::createResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Omnipay\BillPay\Message;
4
5
use Omnipay\BillPay\Message\RequestData\CancelTrait;
6
use Omnipay\Common\Message\ResponseInterface;
7
use SimpleXMLElement;
8
9
/**
10
 * Message RefundRequest
11
 * Example xml:
12
 * <code>
13
 * <?xml version="1.0" encoding="UTF-8"?>
14
 * <data tcaccepted="1" expecteddaystillshipping="0" capturerequestnecessary="0" paymenttype="1" api_version="1.5.11">
15
 *   <default_params mid="4441" pid="6021" bpsecure="25d55ad283aa400af464c76d713c07ad"/>
16
 *   <cancel_params carttotalgross="3390" currency="EUR" reference="Testbestellung123"/>
17
 * </data>
18
 * </code>
19
 *
20
 * @link      https://techdocs.billpay.de/de/An_Entwickler/XML_API/Cancel.html
21
 *
22
 * @author    Andreas Lange <[email protected]>
23
 * @copyright 2016, Connox GmbH
24
 * @license   MIT
25
 */
26
class RefundRequest extends AbstractRequest
27
{
28
    use CancelTrait;
29
30
    /**
31
     * Get the raw data array for this message. The format of this varies from gateway to
32
     * gateway, but will usually be either an associative array, or a SimpleXMLElement.
33
     *
34
     * @return SimpleXMLElement
35
     */
36 2
    public function getData()
37
    {
38 2
        $data = $this->getBaseData();
39
40 2
        $this->appendCancel($data);
41
42 2
        return $data;
43
    }
44
45
    /**
46
     * @param SimpleXMLElement $response
47
     *
48
     * @return ResponseInterface
49
     */
50 1
    protected function createResponse($response)
51
    {
52 1
        return $this->response = new RefundResponse($this, $response);
53
    }
54
55
    /**
56
     * @return string
57
     */
58 1
    protected function getEndpoint()
59
    {
60 1
        return parent::getEndpoint() . '/cancel';
61
    }
62
}
63