@@ -19,6 +19,18 @@ class QRCodeGatewayTest extends GatewayTestCase
1919 protected function setUp ()
2020 {
2121 $ this ->gateway = Omnipay::create ('MoMo_QRCode ' , $ this ->getHttpClient (), $ this ->getHttpRequest ());
22+ $ this ->gateway ->setPublicKey ('-----BEGIN PUBLIC KEY-----
23+ MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAiBIo9EMTElPppPejirL1cdgCuZUoBzGZ
24+ F3SyrTp+xdMnIXSOiFYG+zHmI1lFzoEbEd1JwXAUV52gn/oAkUo+2qwuqZAPdkm714tiyjvxXE/0
25+ WYLl8X1K8uCSK47u26CnOLgNB6iW1m9jog00i9XV/AmKI1U8OioLFSp1BwMf3O+jA9uuRfj1Lv5Q
26+ 0Q7RMtk4tgV924+D8mY/y3otBp5b+zX0NrWkRqwgPly6NeXN5LwqRj0LwAEVVwGbpl6V2cztYv94
27+ ZHjGzNziFJli2D0Vpb/HRPP6ibXvllgbL4UXU4Izqhxml8gwd74jXaNaEgNJGhjjeUXR1sAm7Mpj
28+ qqgyxpx6B2+GpjWtEwvbJuO8DsmQNsm+bJZhw46uf9AuY5VSYy2cAF1XMXSAPNLqYEE8oVUki4IW
29+ YOEWSNXcQwikJC25rAErbyst/0i8RN4yqgiO/xVA1J1vdmRQTvGMXPGbDFpVca4MkHHLrkdC3Z3C
30+ zgMkbIqnpaDYoIHZywraHWA7Zh5fDt/t7FzX69nbGg8i4QFLzIm/2RDPePJTY2R24w1iVO5RhEbK
31+ EaTBMuibp4UJH+nEQ1p6CNdHvGvWz8S0izfiZmYIddaPatQTxYRq4rSsE/+2L+9RE9HMqAhQVveh
32+ RGWWiGSY1U4lWVeTGq2suCNcMZdgDMbbIaSEJJRQTksCAwEAAQ==
33+ -----END PUBLIC KEY----- ' );
2234 $ this ->gateway ->setAccessKey ('E8HZuQRy2RsjVtZp ' );
2335 $ this ->gateway ->setPartnerCode ('MOMO0HGO20180417 ' );
2436 $ this ->gateway ->setSecretKey ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
@@ -35,6 +47,48 @@ public function testNotification()
3547 $ this ->assertEquals ('MOMO0HGO20180417 ' , $ response ->partnerCode );
3648 }
3749
50+ public function testPayConfirm ()
51+ {
52+ $ this ->setMockHttpResponse ('PayConfirm.txt ' );
53+ $ response = $ this ->gateway ->payConfirm ([
54+ "partnerRefId " => "Merchant123556666 " ,
55+ "requestType " => "capture " ,
56+ "requestId " => "1512529262248 " ,
57+ "momoTransId " => "12436514111 " ,
58+ "customerNumber " => "0963181714 " ,
59+ ])->send ();
60+
61+ $ this ->assertTrue ($ response ->isSuccessful ());
62+ $ this ->assertEquals (30000 , $ response ->data ['amount ' ]);
63+ }
64+
65+ public function testRefund ()
66+ {
67+ $ this ->setMockHttpResponse ('Refund.txt ' );
68+ $ response = $ this ->gateway ->refund ([
69+ "partnerRefId " => "Merchant123556666 " ,
70+ "requestType " => "capture " ,
71+ "requestId " => "1512529262248 " ,
72+ "momoTransId " => "12436514111 " ,
73+ "amount " => 30000
74+ ])->send ();
75+
76+ $ this ->assertTrue ($ response ->isSuccessful ());
77+ $ this ->assertEquals (30000 , $ response ->amount );
78+ }
79+
80+ public function testQueryTransaction ()
81+ {
82+ $ this ->setMockHttpResponse ('QueryTransaction.txt ' );
83+ $ response = $ this ->gateway ->queryTransaction ([
84+ "partnerRefId " => "Merchant123556666 " ,
85+ "requestId " => "1512529262248 " ,
86+ "momoTransId " => "12436514111 " ,
87+ ])->send ();
88+
89+ $ this ->assertTrue ($ response ->isSuccessful ());
90+ }
91+
3892 /**
3993 * @doesNotPerformAssertions
4094 */
0 commit comments