AllInOneGateway   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 71
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A completePurchase() 0 4 1
A notification() 0 4 1
A purchase() 0 4 1
A queryTransaction() 0 4 1
A refund() 0 4 1
A queryRefund() 0 4 1
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-momo
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace Omnipay\MoMo;
9
10
use Omnipay\Common\AbstractGateway;
11
use Omnipay\MoMo\Message\AllInOne\RefundRequest;
12
use Omnipay\MoMo\Message\AllInOne\PurchaseRequest;
13
use Omnipay\MoMo\Message\AllInOne\QueryRefundRequest;
14
use Omnipay\MoMo\Message\AllInOne\NotificationRequest;
15
use Omnipay\MoMo\Message\AllInOne\CompletePurchaseRequest;
16
use Omnipay\MoMo\Message\AllInOne\QueryTransactionRequest;
17
18
/**
19
 * @link https://developers.momo.vn/#/docs/aio/
20
 *
21
 * @author Vuong Minh <[email protected]>
22
 * @since 1.0.0
23
 */
24
class AllInOneGateway extends AbstractGateway
25
{
26
    use Concerns\Parameters;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getName(): string
32
    {
33
        return 'MoMo AIO';
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     * @return \Omnipay\Common\Message\RequestInterface|CompletePurchaseRequest
39
     */
40
    public function completePurchase(array $options = []): CompletePurchaseRequest
41
    {
42
        return $this->createRequest(CompletePurchaseRequest::class, $options);
43
    }
44
45
    /**
46
     * Tạo request notification gửi từ MoMo.
47
     *
48
     * @param  array  $options
49
     * @return \Omnipay\Common\Message\RequestInterface|NotificationRequest
50
     */
51
    public function notification(array $options = []): NotificationRequest
52
    {
53
        return $this->createRequest(NotificationRequest::class, $options);
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     * @return \Omnipay\Common\Message\RequestInterface|PurchaseRequest
59
     */
60
    public function purchase(array $options = []): PurchaseRequest
61
    {
62
        return $this->createRequest(PurchaseRequest::class, $options);
63
    }
64
65
    /**
66
     * Tạo yêu cầu truy vấn thông tin giao dịch đến MoMo.
67
     *
68
     * @param  array  $options
69
     * @return \Omnipay\Common\Message\RequestInterface|QueryTransactionRequest
70
     */
71
    public function queryTransaction(array $options = []): QueryTransactionRequest
72
    {
73
        return $this->createRequest(QueryTransactionRequest::class, $options);
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     * @return \Omnipay\Common\Message\RequestInterface|RefundRequest
79
     */
80
    public function refund(array $options = [])
81
    {
82
        return $this->createRequest(RefundRequest::class, $options);
83
    }
84
85
    /**
86
     * Tạo yêu cầu truy vấn thông tin hoàn tiền đến MoMo.
87
     *
88
     * @return \Omnipay\Common\Message\RequestInterface|QueryRefundRequest
89
     */
90
    public function queryRefund(array $options = [])
91
    {
92
        return $this->createRequest(QueryRefundRequest::class, $options);
93
    }
94
}
95