Skip to content

Commit

Permalink
增加apple pay 付款方式 及圓夢分期,30N 分期期數
Browse files Browse the repository at this point in the history
  • Loading branch information
AllennChang committed May 25, 2022
1 parent 225a0ee commit afcabc4
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 47 deletions.
68 changes: 35 additions & 33 deletions ECPAY_Payment_node_js/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions ECPAY_Payment_node_js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 綠界 全方位(All In One)金流介接Node.js 第一版
---

## 1. 介紹

- 綠界對於有收款需求的會員,提供完整的交易介接API,並有多種收款方式(All In One)可選擇使用。 本套件為Node.js版,可使用作建立訂單,接受付款通知,查詢訂單等金流交易的應用。
- 收款方式清單:
- 信用卡(一次付清、分期付款、定期定額)
- 網路ATM
- ATM櫃員機
- 超商代碼
- 超商條碼
- Apple Pay
- Google Pay (須特別申請才能使用)(原Android Pay)


## 2. 安裝環境
- node-v6.11.0-x64 以上
- ECMA Script6


## 3. 使用教學
- 使用者文件放置於Doc資料夾內,可供參閱



## 4. 聯絡我們
- 綠界技術服務工程師信箱: [email protected]




[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)

57 changes: 57 additions & 0 deletions ECPAY_Payment_node_js/example/aio_check_out_applepay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Created by ying.wu on 2017/6/27.
*/
const ecpay_payment = require('../lib/ecpay_payment.js')
//參數值為[PLEASE MODIFY]者,請在每次測試時給予獨特值
//若要測試非必帶參數請將base_param內註解的參數依需求取消註解 //
let base_param = {
MerchantTradeNo: 'PLEASE MODIFY', //請帶20碼uid, ex: f0a0d7e9fae1bb72bc93
MerchantTradeDate: 'PLEASE MODIFY', //ex: 2017/02/13 15:45:30
TotalAmount: '100',
TradeDesc: '測試交易描述',
ItemName: '測試商品等',
ReturnURL: 'http://192.168.0.1',
// ChooseSubPayment: '',
// OrderResultURL: 'http://192.168.0.1/payment_result',
// NeedExtraPaidInfo: '1',
// ClientBackURL: 'https://www.google.com',
// ItemURL: 'http://item.test.tw',
// Remark: '交易備註',
// HoldTradeAMT: '1',
// StoreID: '',
// CustomField1: '',
// CustomField2: '',
// CustomField3: '',
// CustomField4: ''
}


// 若要測試開立電子發票,請將inv_params內的"所有"參數取消註解 //
let inv_params = {
// RelateNumber: 'PLEASE MODIFY', //請帶30碼uid ex: SJDFJGH24FJIL97G73653XM0VOMS4K
// CustomerID: 'MEM_0000001', //會員編號
// CustomerIdentifier: '', //統一編號
// CustomerName: '測試買家',
// CustomerAddr: '測試用地址',
// CustomerPhone: '0123456789',
// CustomerEmail: '[email protected]',
// ClearanceMark: '2',
// TaxType: '1',
// CarruerType: '',
// CarruerNum: '',
// Donation: '2',
// LoveCode: '',
// Print: '1',
// InvoiceItemName: '測試商品1|測試商品2',
// InvoiceItemCount: '2|3',
// InvoiceItemWord: '個|包',
// InvoiceItemPrice: '35|10',
// InvoiceItemTaxType: '1|1',
// InvoiceRemark: '測試商品1的說明|測試商品2的說明',
// DelayDay: '0',
// InvType: '07'
}
const options = require('../conf/config-example'),
create = new ecpay_payment(options),
htm = create.payment_client.aio_check_out_applepay(parameters = base_param, invoice = inv_params)
console.log(htm)
3 changes: 1 addition & 2 deletions ECPAY_Payment_node_js/example/aio_check_out_credit_divide.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ let inv_params = {
}

const inst = '12', //分期期數
amt = 100, //分期總金額
options = require('../conf/config-example')
create = new ecpay_payment(options),
htm = create.payment_client.aio_check_out_credit_divide(parameters = base_param, invoice = inv_params, installment = inst, amount = amt)
htm = create.payment_client.aio_check_out_credit_divide(parameters = base_param, invoice = inv_params, installment = inst)
console.log(htm)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const ecpay_payment = require('../lib/ecpay_payment.js')
//參數值為[PLEASE MODIFY]者,請在每次測試時給予獨特值
//若要測試非必帶參數請將base_param內註解的參數依需求取消註解 //
let base_param = {

MerchantTradeNo: 'PLEASE MODIFY', //請帶20碼uid, ex: f0a0d7e9fae1bb72bc93
MerchantTradeDate: 'PLEASE MODIFY', //ex: 2017/02/13 15:45:30
TotalAmount: '100',
Expand Down
8 changes: 2 additions & 6 deletions ECPAY_Payment_node_js/lib/ecpay_payment/ECpayPayment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<param type="Opt" require="1" name="ChoosePayment">
<option>ALL</option>
<!-- <option>GooglePay</option>--><!--2019/09/30暫時關閉GooglePay付款方式-->
<option>ApplePay</option>
<option>Credit</option>
<condparam owner="Credit">
<!--Reqirement checking of following credit card related sub parameter would be handled in
Expand Down Expand Up @@ -73,12 +74,7 @@
<option>2</option>
</param>
<param type="String" require="0" name="CreditInstallment" category="Divide">
<pattern>^(3|6|12|18|24){1}(,3|,6|,12|,18|,24){0,4}$</pattern>
</param>
<param type="Int" require="0" name="InstallmentAmount" category="Divide">
<mode>GE</mode> <!--BETWEEN, GE, LE, EXCLUDE -->
<maximum></maximum>
<minimal>1</minimal>
<pattern>^(3|6|12|18|24|30N){1}(,3|,6|,12|,18|,24|,30N){0,5}$</pattern>
</param>
<param type="Int" require="0" name="PeriodAmount" category="Period">
<mode>GE</mode> <!--BETWEEN, GE, LE, EXCLUDE -->
Expand Down
12 changes: 7 additions & 5 deletions ECPAY_Payment_node_js/lib/ecpay_payment/payment_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ class ECpayPaymentClient{
let html = this._aiochkout_pos_proc(parameters);
return html;
}

aio_check_out_applepay(parameters, invoice={}){
let unsupport = [];
this._aiochkout_base_proc(parameters, invoice, unsupport, 'ApplePay');
let html = this._aiochkout_pos_proc(parameters);
return html;
}
aio_check_out_credit_onetime(parameters, invoice={}){
let unsupport = [];
this._aiochkout_base_proc(parameters, invoice, unsupport, 'Credit');
Expand All @@ -39,13 +44,10 @@ class ECpayPaymentClient{
return html;
}*/

aio_check_out_credit_divide(parameters, invoice={}, installment, amount){
aio_check_out_credit_divide(parameters, invoice={}, installment){
let unsupport = ['IgnorePayment', 'Redeem', 'PeriodAmount', 'PeriodType', 'Frequency', 'ExecTimes', 'PeriodReturnURL'];
this._aiochkout_base_proc(parameters, invoice, unsupport, 'Credit');
parameters['CreditInstallment'] = installment;
if (parseInt(parameters['TotalAmount']) !== parseInt(amount)){
parameters['InstallmentAmount'] = amount;
}
let html = this._aiochkout_pos_proc(parameters);
return html;
}
Expand Down

0 comments on commit afcabc4

Please sign in to comment.