Skip to content

Commit bd426d4

Browse files
committed
PayMode
1 parent 415c9fd commit bd426d4

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/Message/XWallet/PurchaseRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function getData()
9292
return [
9393
'FirmOrderNo' => $this->getTransactionId(),
9494
'PayType' => (int) $this->getPaymentMethod() ?: 1,
95+
'PayMode' => (int) $this->getPayMode() ?: 1,
9596
'Price' => (int) $this->getAmount(),
9697
'Mobile' => $this->getMobile(),
9798
];

src/Traits/XWallet/HasEPays.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ public function setHashIV($value)
2828
return $this->setParameter('HashIV', $value);
2929
}
3030

31+
/**
32+
* 購買模式:1.點數卡、4.模式A、5.模式B
33+
*
34+
* @param int $value
35+
*/
36+
public function setPayMode($value)
37+
{
38+
return $this->setParameter('PayMode', $value);
39+
}
40+
41+
/**
42+
* @return ?int
43+
*/
44+
public function getPayMode()
45+
{
46+
return $this->getParameter('PayMode');
47+
}
48+
3149
/**
3250
* @throws InvalidResponseException
3351
*/

tests/Message/XWallet/PurchaseRequestTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function testGetData(): void
2424
'transactionId' => 'test202309011123001',
2525
'amount' => 100,
2626
'PayType' => 1,
27+
'PayMode' => 4,
2728
'Mobile' => '0912345678',
2829
];
2930
$request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
@@ -32,6 +33,7 @@ public function testGetData(): void
3233
self::assertEquals([
3334
'FirmOrderNo' => 'test202309011123001',
3435
'PayType' => 1,
36+
'PayMode' => 4,
3537
'Price' => 100,
3638
'Mobile' => '0912345678',
3739
], $request->getData());
@@ -43,6 +45,7 @@ public function testSendData()
4345
'transactionId' => 'test202309011123001',
4446
'amount' => 100,
4547
'PayType' => 1,
48+
'PayMode' => 4,
4649
'Mobile' => '0912345678',
4750
];
4851
$request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
@@ -55,7 +58,7 @@ public function testSendData()
5558
self::assertEquals('POST', $response->getRedirectMethod());
5659
self::assertEquals([
5760
'Hashkey' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
58-
'data' => 'u4OlyM8T0QFQPQkL8XhzfxH5QVFmVcYqUW+hXuic5a+y9cIjEY8qr3gOoIUmOZLufZtW/3fDRNP2yQAR2kt4Uaqpq24cR9GTgQBXg5eZDjEzsv4hCE+vXqHdQeNBOe+R',
61+
'data' => 'u4OlyM8T0QFQPQkL8XhzfxH5QVFmVcYqUW+hXuic5a+y9cIjEY8qr3gOoIUmOZLuxQ/kHvhMtvcaw2MdnEAgcJfL2SjqVkp3B1MtO3w4yDKWmAMbaYfTxuP2O3T8d4qa',
5962
], $response->getRedirectData());
6063
}
6164
}

0 commit comments

Comments
 (0)