|
1 | 1 | //@ts-nocheck |
2 | 2 | import { Merchant } from '../../feature/Merchant'; |
3 | 3 | import { CreditOneTimePayment } from '../../feature/Payment'; |
| 4 | +import { getCurrentTaipeiTimeString } from '../../utils'; |
4 | 5 | import { TEST_MERCHANT_CONFIG, TEST_BASE_PARAMS } from '../test_setting'; |
5 | 6 |
|
6 | 7 | describe('CreditOneTimePayment: Check Credit Base Params Types', () => { |
@@ -58,36 +59,25 @@ describe('CreditOneTimePayment: Check Credit Base Params Types', () => { |
58 | 59 | }); |
59 | 60 | }); |
60 | 61 |
|
61 | | -// describe('CreditOneTimePayment: html', () => { |
62 | | -// const merchant = new Merchant('Test', TEST_MERCHANT_CONFIG); |
| 62 | +describe('CreditOneTimePayment: Redirect Post Form', () => { |
| 63 | + const merchant = new Merchant('Test', TEST_MERCHANT_CONFIG); |
63 | 64 |
|
64 | | -// const baseParams = { |
65 | | -// MerchantTradeNo: 'nodeecpayaio0011', |
66 | | -// MerchantTradeDate: '2021/05/22 11:20:20', |
67 | | -// TotalAmount: 999, |
68 | | -// TradeDesc: 'node-ecpay-aio testing order for CreditOneTimePayment', |
69 | | -// ItemName: 'test item name', |
70 | | -// }; |
| 65 | + const baseParams: BasePaymentParams = { |
| 66 | + MerchantTradeNo: `nea${getCurrentTaipeiTimeString({ format: 'Serial' })}`, |
| 67 | + MerchantTradeDate: getCurrentTaipeiTimeString(), |
| 68 | + TotalAmount: 999, |
| 69 | + TradeDesc: 'node-ecpay-aio testing order for CreditOneTimePayment', |
| 70 | + ItemName: 'test item name', |
| 71 | + }; |
71 | 72 |
|
72 | | -// test('Checkout with ', async () => { |
73 | | -// const payment = merchant.createPayment( |
74 | | -// CreditOneTimePayment, |
75 | | -// baseParams, |
76 | | -// {} |
77 | | -// ); |
| 73 | + test('Checkout with ', async () => { |
| 74 | + const payment = merchant.createPayment( |
| 75 | + CreditOneTimePayment, |
| 76 | + baseParams, |
| 77 | + {} |
| 78 | + ); |
78 | 79 |
|
79 | | -// const html = await payment.checkout({ |
80 | | -// RelateNumber: 'rl-no', |
81 | | -// TaxType: '1', |
82 | | -// Donation: '0', |
83 | | -// Print: '0', |
84 | | -// InvoiceItemName: 'item1|item2', |
85 | | -// InvoiceItemCount: '2|5', |
86 | | -// InvoiceItemWord: '台|張', |
87 | | -// InvoiceItemPrice: '100|50', |
88 | | -// InvoiceRemark: '測試發票備註', |
89 | | -// CustomerPhone: '0911111111', |
90 | | -// }); |
91 | | -// console.log(html); |
92 | | -// }); |
93 | | -// }); |
| 80 | + const html = await payment.checkout(); |
| 81 | + expect(html.startsWith('<form id="_form_aio_checkout"')).toBe(true); |
| 82 | + }); |
| 83 | +}); |
0 commit comments