Skip to content

Commit 12f879f

Browse files
Added pay methods to gateway tests.
1 parent 17b5fe2 commit 12f879f

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

tests/AppInApp/AppInAppGatewayTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,48 @@ public function testPurchaseFailure()
6060
$this->assertEquals(10000, $response->amount);
6161
}
6262

63+
public function testPayConfirm()
64+
{
65+
$this->setMockHttpResponse('PayConfirm.txt');
66+
$response = $this->gateway->payConfirm([
67+
"partnerRefId" => "Merchant123556666",
68+
"requestType" => "capture",
69+
"requestId" => "1512529262248",
70+
"momoTransId" => "12436514111",
71+
"customerNumber" => "0963181714",
72+
])->send();
73+
74+
$this->assertTrue($response->isSuccessful());
75+
$this->assertEquals(30000, $response->data['amount']);
76+
}
77+
78+
public function testRefund()
79+
{
80+
$this->setMockHttpResponse('Refund.txt');
81+
$response = $this->gateway->refund([
82+
"partnerRefId" => "Merchant123556666",
83+
"requestType" => "capture",
84+
"requestId" => "1512529262248",
85+
"momoTransId" => "12436514111",
86+
"amount" => 30000,
87+
])->send();
88+
89+
$this->assertTrue($response->isSuccessful());
90+
$this->assertEquals(30000, $response->amount);
91+
}
92+
93+
public function testQueryTransaction()
94+
{
95+
$this->setMockHttpResponse('QueryTransaction.txt');
96+
$response = $this->gateway->queryTransaction([
97+
"partnerRefId" => "Merchant123556666",
98+
"requestId" => "1512529262248",
99+
"momoTransId" => "12436514111",
100+
])->send();
101+
102+
$this->assertTrue($response->isSuccessful());
103+
}
104+
63105
/**
64106
* @doesNotPerformAssertions
65107
*/

tests/POS/POSGatewayTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,33 @@ public function testPayConfirm()
8585
$this->assertEquals(30000, $response->data['amount']);
8686
}
8787

88+
public function testRefund()
89+
{
90+
$this->setMockHttpResponse('Refund.txt');
91+
$response = $this->gateway->refund([
92+
"partnerRefId" => "Merchant123556666",
93+
"requestType" => "capture",
94+
"requestId" => "1512529262248",
95+
"momoTransId" => "12436514111",
96+
"amount" => 30000
97+
])->send();
98+
99+
$this->assertTrue($response->isSuccessful());
100+
$this->assertEquals(30000, $response->amount);
101+
}
102+
103+
public function testQueryTransaction()
104+
{
105+
$this->setMockHttpResponse('QueryTransaction.txt');
106+
$response = $this->gateway->queryTransaction([
107+
"partnerRefId" => "Merchant123556666",
108+
"requestId" => "1512529262248",
109+
"momoTransId" => "12436514111",
110+
])->send();
111+
112+
$this->assertTrue($response->isSuccessful());
113+
}
114+
88115
/**
89116
* @doesNotPerformAssertions
90117
*/

tests/QRCode/QRCodeGatewayTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)