CompletePurchaseResponse::getMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Omnipay\Worldline\Message;
4
5
use Omnipay\Common\Message\AbstractResponse;
6
7
/**
8
 * Worldline Complete Purchase Response
9
 */
10
class CompletePurchaseResponse extends AbstractResponse
11
{
12
    /**
13
     * Is the response successful?
14
     *
15
     * @return boolean
16
     */
17
    public function isSuccessful()
18
    {
19
        return $this->data->createdPaymentOutput->paymentStatusCategory == 'SUCCESSFUL';
20
    }
21
22
    /**
23
     * Get the authorisation code if available.
24
     *
25
     * @return null|string
26
     */
27
    public function getTransactionReference()
28
    {
29
        return $this->data->createdPaymentOutput->payment->id ?? null;
30
    }
31
32
    /**
33
     * Get the merchant response message if available.
34
     *
35
     * @return null|string
36
     */
37
    public function getMessage()
38
    {
39
        return $this->data->createdPaymentOutput->payment->status;
40
    }
41
}
42