Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AllennChang committed Mar 2, 2021
2 parents b43ec90 + 403786f commit 88412dc
Show file tree
Hide file tree
Showing 25 changed files with 615 additions and 586 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Doc/
ECPAY_Payment_node_js/.idea/
ECPAY_Payment_node_js/node_modules/
.idea/
19 changes: 19 additions & 0 deletions ECPAY_Payment_node_js/conf/config-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const options = {
"OperationMode": "Test", //Test or Production
"MercProfile": {
"MerchantID": "2000132",
"HashKey": "5294y06JbISpM5x9",
"HashIV": "v77hoKGq4kWxNNIS"
},
"IgnorePayment": [
// "Credit",
// "WebATM",
// "ATM",
// "CVS",
// "BARCODE",
// "AndroidPay"
],
"IsProjectContractor": false
}

module.exports = options
26 changes: 13 additions & 13 deletions ECPAY_Payment_node_js/example/aio_capture.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* Created by ying.wu on 2017/6/27.
*/
const ecpay_payment = require('../lib/ecpay_payment.js');
const ecpay_payment = require('../lib/ecpay_payment.js')
//參數值為[PLEASE MODIFY]者,請在每次測試時給予獨特值
//若要測試非必帶參數請將base_param內註解的參數依需求取消註解 //
let base_param = {
MerchantTradeNo: 'PLEASE MODIFY', //請帶20碼uid, ex: f0a0d7e9fae1bb72bc93
CaptureAMT: '70',
UserRefundAMT: '30',
// MerchantID: '',
// Remark: '撥款備註'
};

let create = new ecpay_payment();
let res = create.exec_grant_refund.aio_capture(parameters = base_param);
MerchantTradeNo: 'PLEASE MODIFY', //請帶20碼uid, ex: f0a0d7e9fae1bb72bc93
CaptureAMT: '70',
UserRefundAMT: '30',
// MerchantID: '',
// Remark: '撥款備註'
}
const options = require('../conf/config-example'),
create = new ecpay_payment(options),
res = create.exec_grant_refund.aio_capture(parameters = base_param)
res.then(function (result) {
console.log(result);
console.log(result)
}).catch(function (err) {
console.log(err);
});
console.log(err)
})
94 changes: 48 additions & 46 deletions ECPAY_Payment_node_js/example/aio_check_out_all.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@

/**
* Created by ying.wu on 2017/6/27.
*/
const ecpay_payment = require('../lib/ecpay_payment.js');
const ecpay_payment = require('../lib/ecpay_payment.js')
//參數值為[PLEASE MODIFY]者,請在每次測試時給予獨特值
//若要測試非必帶參數請將base_param內註解的參數依需求取消註解 //
let base_param = {
MerchantTradeNo: 'f0a0sa9fabkkuy111', //請帶20碼uid, ex: f0a0d7e9fae1bb72bc93
MerchantTradeDate: '2018/06/13 15:45:30', //ex: 2017/02/13 15:45:30
TotalAmount: '100',
TradeDesc: '測試交易描述',
ItemName: '測試商品等',
ReturnURL: 'https://us-central1-qraft-app.cloudfunctions.net/dev-createSampleOrder',
EncryptType:'1',
// ChooseSubPayment: '',
// OrderResultURL: 'http://192.168.0.1/payment_result',
// NeedExtraPaidInfo: '1',
// ClientBackURL: 'https://www.google.com',
// ItemURL: 'http://item.test.tw',
// Remark: '交易備註',
// StoreID: '',
// CustomField1: '',
// CustomField2: '',
// CustomField3: '',
// CustomField4: ''
};
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: 'SJDFJas97Gj11VOMSfK', //請帶30碼uid ex: SJDFJGH24FJIL97G73653XM0VOMS4K
CustomerID: '', //會員編號
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'
};
// 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_all(parameters = base_param, invoice = inv_params)
console.log(htm)

let create = new ecpay_payment();
let htm = create.payment_client.aio_check_out_all(parameters = base_param, invoice = inv_params);
console.log(htm);
123 changes: 63 additions & 60 deletions ECPAY_Payment_node_js/example/aio_check_out_atm.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
/**
* Created by ying.wu on 2017/6/27.
*/
const ecpay_payment = require('../lib/ecpay_payment.js');
//參數值為[PLEASE MODIFY]者,請在每次測試時給予獨特值
//若要測試非必帶參數請將base_param內註解的參數依需求取消註解 //
let base_param = {
MerchantTradeNo: 'f0a0d7eggfhf11Y', //請帶20碼uid, ex: f0a0d7e9fae1bb72bc93
MerchantTradeDate: '2018/06/13 15:45:30', //ex: 2017/02/13 15:45:30
TotalAmount: '100',
TradeDesc: '測試交易描述',
ItemName: '測試商品等',
ReturnURL: 'http://192.168.0.1',
EncryptType:'1',
// ChooseSubPayment: '',
// OrderResultURL: 'http://192.168.0.1/payment_result',
// NeedExtraPaidInfo: '1',
// ClientBackURL: 'https://www.google.com',
// ItemURL: 'http://item.test.tw',
// Remark: '交易備註',
// 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'
};

let pay_info_url = 'http://192.168.0.1';
let exp = '7';
let cli_redir_url = 'http://www.ecpay.com.tw';

let create = new ecpay_payment();
let htm = create.payment_client.aio_check_out_atm(parameters = base_param, url_return_payinfo = pay_info_url, exp_period = exp, client_redirect = cli_redir_url, invoice = inv_params);
console.log(htm);
/**
* 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 pay_info_url = 'http://192.168.0.1',
exp = '7',
cli_redir_url = 'http://192.168.0.1/payment_result',
options = require('../conf/config-example'),
create = new ecpay_payment(options),
htm = create.payment_client.aio_check_out_atm(parameters = base_param, url_return_payinfo = pay_info_url, exp_period = exp, client_redirect = cli_redir_url, invoice = inv_params)
console.log(htm)

Loading

0 comments on commit 88412dc

Please sign in to comment.