Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
建議使用 Node.js 套件管理工具 npm 安裝。
$ npm install allpay
安裝完畢後,你可以使用 require
載入套件:
var Allpay = require("allpay");
var allpay = new Allpay({
merchantID: "YOUR_MERCHANT_ID",
hashKey: "YOUR_HASH_KEY",
hashIV: "YOUR_HASH_IV",
mode: "test",
debug: false
});
merchantID
:必填,廠商編號(由 AllPay 提供)。
hashKey
:必填,全方位金流介接的 HashKey。
hashIV
:必填,全方位金流介接的 HashIV。
mode
:選填,於生產環境使用時請設定為 "production"(預設為 "test")。
debug
:選填,設為 true 可查看除錯訊息(預設為 false)。
allpay.setHost({
baseUrl: "payment-stage.allpay.com.tw",
port: 80,
useSSL: false
});
baseUrl
:選填,介接網址(預設為 payment.allpay.com.tw)。
port
:選填,連接埠(預設為 443)。
useSSL
:選填,使用 SSL 連線(預設為 true)。
options
, callback
)options
, callback
)options
, callback
)options
, callback
)options
, callback
)options
, callback
)data
, encryptType
)data
)allpay.aioCheckOut({
MerchantTradeNo: "TS20160502000001",
MerchantTradeDate: "2016/05/02 00:00:00",
TotalAmount: 100,
TradeDesc: "商城購物測試",
Items: [{
name: "商品一",
quantity: "1",
price: 100
}],
ReturnURL: "http://localhost/receive",
ChoosePayment: "ALL"
}, function(err, result) {
// Do something here...
});
allpay.aioCheckOut({
MerchantTradeNo: "TS20160502000001",
MerchantTradeDate: "2016/05/02 00:00:00",
TotalAmount: 100,
TradeDesc: "商城購物測試",
Items: [{
name: "商品一",
quantity: "1",
price: 100
}],
ReturnURL: "http://localhost/receive",
ChoosePayment: "ALL",
InvoiceMark: "Y",
RelateNumber: "TS20160502000001",
CustomerEmail: "test@localhost.com",
TaxType: "1",
InvoiceItems: [{
name: "商品一",
count: "1",
word: "個",
price: "100",
taxType: "1"
}],
InvType: "07"
}, function(err, result) {
// Do something here...
});
allpay.aioCheckOut({
MerchantTradeNo: "TS20160502000001",
MerchantTradeDate: "2016/05/02 00:00:00",
TotalAmount: 100,
TradeDesc: "商城購物測試",
Items: [{
name: "商品一",
quantity: "1",
price: 100
}],
ReturnURL: "http://localhost/receive",
ChoosePayment: "Credit",
PeriodAmount: 100,
PeriodType: "M",
Frequency: 1,
ExecTimes: 6,
}, function(err, result) {
// Do something here...
});
allpay.queryTradeInfo({
MerchantTradeNo: "TS20160502000001"
}, function(err, result) {
// Do something here...
});
allpay.queryCreditCardPeriodInfo({
MerchantTradeNo: "TS20160502000001"
}, function(err, result) {
// Do something here...
});
allpay.doAction({
MerchantTradeNo: "TS20160502000001",
TradeNo: "1605020000459168",
Action: "C",
TotalAmount: "100",
}, function(err, result) {
// Do something here...
});
allpay.aioChargeback({
MerchantTradeNo: "TS20160502000001",
TradeNo: "1605020000459168",
ChargeBackTotalAmount: "100",
}, function(err, result) {
// Do something here...
});
allpay.capture({
MerchantTradeNo: "TS20160502000001",
CaptureAMT: 100,
UserRefundAMT: 0,
}, function(err, result) {
// Do something here...
});
var checkMacValue = allpay.genCheckMacValue({
MerchantID: "2000214",
MerchantTradeNo: "TS20160502000001",
MerchantTradeDate: "2016/05/02 00:00:00",
PaymentType: "aio",
TotalAmount: 100,
TradeDesc: "商城購物測試",
ItemName: "商品一 100 元 x1",
ReturnURL: "http://localhost/receive",
ChoosePayment: "ALL",
NeedExtraPaidInfo: "N",
DeviceSource: "P",
});
var isDataValid = allpay.isDataValid({
HandlingCharge: "5",
ItemName: "商品一 100 元 x1",
MerchantID: "2000214",
MerchantTradeNo: "TS20160502000001",
PayAmt: "0",
PaymentDate: "2016/05/02 00:01:23",
PaymentType: "Credit_CreditCard",
PaymentTypeChargeFee: "5",
RedeemAmt: "0",
TradeAmt: "100",
TradeDate: "2016/05/02 00:00:00",
TradeNo: "1605020000459168",
TradeStatus: "1",
CheckMacValue: "ABE4DDCB8F9895B7FD33858EFB095422"
});
Callback 會返回 2 個參數,分別為 error 和一個 JSON 物件。
以下為範例 callback 函數:
function callback (err, response) {
if (err) {
console.log(err);
} else {
console.dir(response);
}
}
詳細參數說明請參閱全方位金流API介接技術文件。
MIT
1.0.0
2016-05-02
FAQs
AllPay 全方位金流介接 SDK for Node.js
The npm package allpay receives a total of 0 weekly downloads. As such, allpay popularity was classified as not popular.
We found that allpay demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.