taiwan-payment-skill 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
operation,operation_zh,ecpay_endpoint,newebpay_endpoint,payuni_endpoint,smilepay_endpoint,pchomepay_endpoint,ezpay_endpoint,paynow_legacy_endpoint,paynow_modern_endpoint,method,required_fields,notes
|
|
2
|
-
create_order,建立訂單,/Cashier/AioCheckOut/V5,/MPG/mpg_gateway,/api/order/create,/api/SPPayment.asp,/v1/payment,/MPG/mpg_gateway,/service/etopm.aspx,/api/v1/payment-intent/create,POST,"MerchantID,MerchantTradeNo,TotalAmount,TradeDesc,ItemName,ReturnURL",主要付款入口;PChomePay 另有 /v1/payment/atmva (ATM) 與 /v1/payment/barcode (CVS code)
|
|
3
|
-
query_order,查詢訂單,/Cashier/QueryTradeInfo/V5,/API/QueryTradeInfo,/api/order/query,/ezpos/mtmk_utf.asp,/v1/payment/{order_id},/API/QueryTradeInfo,N/A,/api/v1/payment-intent/{id},POST,"MerchantID,MerchantTradeNo,TimeStamp",查詢交易狀態;SmilePay 用 mtmk 端點
|
|
4
|
-
credit_action,信用卡請退款,/CreditDetail/DoAction,/API/CreditCard/Close,/api/credit/action,/api/SPPayment_Modify.asp,/v1/refund,/API/CreditCard/Close,N/A,/api/v1/payment-intent/{id}/refund,POST,"MerchantID,TradeNo,Action,TotalAmount",請款/退款/取消;PayNow 現代版用 PaymentIntent refund
|
|
5
|
-
query_credit,信用卡查詢,/CreditDetail/QueryTrade/V2,/API/CreditCard/TradeInfo,/api/credit/query,N/A,/v1/refund/{refund_id},/API/CreditCard/TradeInfo,N/A,/api/v1/refund/{id},POST,"MerchantID,CreditRefundId",查詢信用卡交易
|
|
6
|
-
periodic_create,定期定額建立,/Cashier/AioCheckOut/V5,/API/CreditCard/Period,/api/trade/periodic,N/A,N/A,/API/CreditCard/Period,N/A,/api/v1/customer (saved card),POST,"PeriodAmount,PeriodType,Frequency,ExecTimes",設定週期付款;PayNow 現代版用 Customer + Card Token 機制
|
|
7
|
-
periodic_query,定期定額查詢,/Cashier/QueryCreditCardPeriodInfo,/API/CreditCard/PeriodInfo,,N/A,N/A,/API/CreditCard/PeriodInfo,N/A,N/A,POST,"MerchantID,MerchantTradeNo",查詢週期付款
|
|
8
|
-
periodic_action,定期定額操作,/CreditDetail/CreditCardPeriodAction,/API/CreditCard/PeriodAlter,,N/A,N/A,/API/CreditCard/PeriodAlter,N/A,N/A,POST,"MerchantID,Action",取消/修改週期
|
|
9
|
-
get_token,取得 Token,N/A,N/A,N/A,N/A,/v1/token,N/A,N/A,N/A,POST,"BasicAuth(APP_ID,SECRET)",PChomePay 兩階段認證;token 預設 28800 秒 (8h) 有效
|
|
10
|
-
balance_query,查詢餘額,N/A,N/A,N/A,N/A,/v1/balance,N/A,N/A,N/A,GET,
|
|
11
|
-
withdraw,提領款項,N/A,N/A,N/A,N/A,/v1/withdraw,N/A,N/A,N/A,POST,"amount,bank,account",PChomePay 提領至銀行
|
|
12
|
-
checkout,跳轉結帳頁,N/A,N/A,N/A,N/A,N/A,N/A,N/A,/api/v1/payment-intent/{id}/checkout,POST,"paymentMethodType,paymentMethodData",PayNow 現代版 Stripe-like checkout flow
|
|
13
|
-
applepay_session,Apple Pay session,N/A,N/A,N/A,N/A,N/A,N/A,N/A,/api/v1/apple-pay/session,POST,"validationURL,domainName",PayNow 現代版 Apple Pay 商家驗證
|
|
14
|
-
applepay_confirm,Apple Pay 確認,N/A,N/A,N/A,N/A,N/A,N/A,N/A,/api/v1/apple-pay/confirm,POST,
|
|
15
|
-
session_create,Shopline 建立結帳會話,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"merchantId,amount,currency,returnUrl",Shopline Redirect 模式; endpoint 為 /sessions/create
|
|
16
|
-
session_query,Shopline 查詢會話,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,GET,
|
|
17
|
-
linepay_request,LINE Pay 建立交易,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,orderId,packages",LINE Pay v4; /v3/payments/request
|
|
18
|
-
linepay_confirm,LINE Pay 確認交易,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,transactionId",LINE Pay; /v3/payments/{transactionId}/confirm
|
|
19
|
-
linepay_capture,LINE Pay 請款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,transactionId",LINE Pay; /v3/payments/authorizations/{transactionId}/capture (含手動請款)
|
|
20
|
-
linepay_void,LINE Pay 取消授權,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,
|
|
21
|
-
linepay_preapproved_pay,LINE Pay 自動扣款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,orderId,productName",LINE Pay 自動扣款 (Preapproved Pay)
|
|
22
|
-
tappay_pay_by_prime,TapPay Prime 付款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"prime,partner_key,merchant_id,amount,details,cardholder",TapPay; /tpc/payment/pay-by-prime
|
|
23
|
-
tappay_pay_by_token,TapPay Token 付款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"card_key,card_token,partner_key,merchant_id,amount,details",TapPay 重複扣款; /tpc/payment/pay-by-card-token
|
|
1
|
+
operation,operation_zh,ecpay_endpoint,newebpay_endpoint,payuni_endpoint,smilepay_endpoint,pchomepay_endpoint,ezpay_endpoint,paynow_legacy_endpoint,paynow_modern_endpoint,opay_endpoint,jkopay_endpoint,sunpay_endpoint,method,required_fields,notes
|
|
2
|
+
create_order,建立訂單,/Cashier/AioCheckOut/V5,/MPG/mpg_gateway,/api/order/create,/api/SPPayment.asp,/v1/payment,/MPG/mpg_gateway,/service/etopm.aspx,/api/v1/payment-intent/create,/Cashier/AioCheckOut/V5,/platform/entry,/v4/cash,POST,"MerchantID,MerchantTradeNo,TotalAmount,TradeDesc,ItemName,ReturnURL",主要付款入口;PChomePay 另有 /v1/payment/atmva (ATM) 與 /v1/payment/barcode (CVS code) | 歐付寶 O'Pay 路徑與綠界相同僅換網域;街口 JKOPAY 為 /platform/entry 且同單號冪等;紅陽 SunPay 為 /v4/cash
|
|
3
|
+
query_order,查詢訂單,/Cashier/QueryTradeInfo/V5,/API/QueryTradeInfo,/api/order/query,/ezpos/mtmk_utf.asp,/v1/payment/{order_id},/API/QueryTradeInfo,N/A,/api/v1/payment-intent/{id},/Cashier/QueryTradeInfo/V5,/platform/inquiry (GET;最多20筆),/v4/query/PaymentCheck,POST,"MerchantID,MerchantTradeNo,TimeStamp",查詢交易狀態;SmilePay 用 mtmk 端點 | 街口 JKOPAY 查詢為 GET 且一次最多 20 筆;紅陽 SunPay 查詢的 pay_result=12 意為查無訂單與交易通知不同義
|
|
4
|
+
credit_action,信用卡請退款,/CreditDetail/DoAction,/API/CreditCard/Close,/api/credit/action,/api/SPPayment_Modify.asp,/v1/refund,/API/CreditCard/Close,N/A,/api/v1/payment-intent/{id}/refund,/CreditDetail/DoAction,/platform/refund,/v3/Service/CardCapture (請款) 與 /v3/Service/CardRefund (退款),POST,"MerchantID,TradeNo,Action,TotalAmount",請款/退款/取消;PayNow 現代版用 PaymentIntent refund | 街口 JKOPAY 退款單號一筆只能退一次;紅陽 SunPay 請款與退款仍在 /v3/ 與交易查詢的 /v4/ 不同
|
|
5
|
+
query_credit,信用卡查詢,/CreditDetail/QueryTrade/V2,/API/CreditCard/TradeInfo,/api/credit/query,N/A,/v1/refund/{refund_id},/API/CreditCard/TradeInfo,N/A,/api/v1/refund/{id},/CreditDetail/QueryTrade/V2,N/A,N/A,POST,"MerchantID,CreditRefundId",查詢信用卡交易
|
|
6
|
+
periodic_create,定期定額建立,/Cashier/AioCheckOut/V5,/API/CreditCard/Period,/api/trade/periodic,N/A,N/A,/API/CreditCard/Period,N/A,/api/v1/customer (saved card),/Cashier/AioCheckOut/V5,/platform/authpay/regular 或 /limited,N/A,POST,"PeriodAmount,PeriodType,Frequency,ExecTimes",設定週期付款;PayNow 現代版用 Customer + Card Token 機制 | 街口 JKOPAY 授權扣款分定期定額 regular 與不定期不定額 limited 兩種;歐付寶 O'Pay 同綠界定期定額
|
|
7
|
+
periodic_query,定期定額查詢,/Cashier/QueryCreditCardPeriodInfo,/API/CreditCard/PeriodInfo,,N/A,N/A,/API/CreditCard/PeriodInfo,N/A,N/A,/Cashier/QueryCreditCardPeriodInfo,/platform/authpay/detail,N/A,POST,"MerchantID,MerchantTradeNo",查詢週期付款
|
|
8
|
+
periodic_action,定期定額操作,/CreditDetail/CreditCardPeriodAction,/API/CreditCard/PeriodAlter,,N/A,N/A,/API/CreditCard/PeriodAlter,N/A,N/A,/CreditDetail/CreditCardPeriodAction,/platform/authpay/transaction (扣款) 與 /cancel (終止),N/A,POST,"MerchantID,Action",取消/修改週期 | 街口 JKOPAY 扣款限 08:00-20:00 UTC+8 且同一 auth_no 不可併發
|
|
9
|
+
get_token,取得 Token,N/A,N/A,N/A,N/A,/v1/token,N/A,N/A,N/A,N/A,N/A,N/A,POST,"BasicAuth(APP_ID,SECRET)",PChomePay 兩階段認證;token 預設 28800 秒 (8h) 有效
|
|
10
|
+
balance_query,查詢餘額,N/A,N/A,N/A,N/A,/v1/balance,N/A,N/A,N/A,N/A,N/A,N/A,GET,pcpay-token header,PChomePay 商家後台帳戶餘額
|
|
11
|
+
withdraw,提領款項,N/A,N/A,N/A,N/A,/v1/withdraw,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,bank,account",PChomePay 提領至銀行
|
|
12
|
+
checkout,跳轉結帳頁,N/A,N/A,N/A,N/A,N/A,N/A,N/A,/api/v1/payment-intent/{id}/checkout,N/A,payment_url (Entry 回傳),交易後導轉紅陽收銀台,POST,"paymentMethodType,paymentMethodData",PayNow 現代版 Stripe-like checkout flow
|
|
13
|
+
applepay_session,Apple Pay session,N/A,N/A,N/A,N/A,N/A,N/A,N/A,/api/v1/apple-pay/session,N/A,N/A,card_type=03 (與 GooglePay 共用),POST,"validationURL,domainName",PayNow 現代版 Apple Pay 商家驗證
|
|
14
|
+
applepay_confirm,Apple Pay 確認,N/A,N/A,N/A,N/A,N/A,N/A,N/A,/api/v1/apple-pay/confirm,N/A,N/A,N/A,POST,applePayPayload,PayNow 現代版 Apple Pay 付款確認
|
|
15
|
+
session_create,Shopline 建立結帳會話,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"merchantId,amount,currency,returnUrl",Shopline Redirect 模式; endpoint 為 /sessions/create
|
|
16
|
+
session_query,Shopline 查詢會話,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,GET,sessionId,Shopline; /sessions/{sessionId}
|
|
17
|
+
linepay_request,LINE Pay 建立交易,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,orderId,packages",LINE Pay v4; /v3/payments/request
|
|
18
|
+
linepay_confirm,LINE Pay 確認交易,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,transactionId",LINE Pay; /v3/payments/{transactionId}/confirm
|
|
19
|
+
linepay_capture,LINE Pay 請款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,transactionId",LINE Pay; /v3/payments/authorizations/{transactionId}/capture (含手動請款)
|
|
20
|
+
linepay_void,LINE Pay 取消授權,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,transactionId,LINE Pay; /v3/payments/authorizations/{transactionId}/void
|
|
21
|
+
linepay_preapproved_pay,LINE Pay 自動扣款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"amount,currency,orderId,productName",LINE Pay 自動扣款 (Preapproved Pay)
|
|
22
|
+
tappay_pay_by_prime,TapPay Prime 付款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"prime,partner_key,merchant_id,amount,details,cardholder",TapPay; /tpc/payment/pay-by-prime
|
|
23
|
+
tappay_pay_by_token,TapPay Token 付款,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,POST,"card_key,card_token,partner_key,merchant_id,amount,details",TapPay 重複扣款; /tpc/payment/pay-by-card-token
|
|
@@ -136,7 +136,7 @@ class PAYUNiPaymentService:
|
|
|
136
136
|
data: 交易資料字典
|
|
137
137
|
|
|
138
138
|
Returns:
|
|
139
|
-
str: AES-GCM 加密後的 hex 字串 (
|
|
139
|
+
str: AES-GCM 加密後的 hex 字串 (base64(密文) + ":::" + base64(tag))
|
|
140
140
|
|
|
141
141
|
Example:
|
|
142
142
|
>>> data = {'MerID': 'MS123', 'TradeAmt': 100}
|
|
@@ -144,6 +144,7 @@ class PAYUNiPaymentService:
|
|
|
144
144
|
>>> len(encrypted) > 0
|
|
145
145
|
True
|
|
146
146
|
"""
|
|
147
|
+
import base64
|
|
147
148
|
# 步驟 1: 轉換為查詢字串
|
|
148
149
|
query_string = urllib.parse.urlencode(data)
|
|
149
150
|
|
|
@@ -151,15 +152,17 @@ class PAYUNiPaymentService:
|
|
|
151
152
|
cipher = AES.new(self.hash_key, AES.MODE_GCM, nonce=self.hash_iv)
|
|
152
153
|
encrypted, tag = cipher.encrypt_and_digest(query_string.encode('utf-8'))
|
|
153
154
|
|
|
154
|
-
# 步驟 3:
|
|
155
|
-
|
|
155
|
+
# 步驟 3: 分別 base64 編碼,用 ":::" 分隔
|
|
156
|
+
encrypted_b64 = base64.b64encode(encrypted).decode('utf-8')
|
|
157
|
+
tag_b64 = base64.b64encode(tag).decode('utf-8')
|
|
158
|
+
return encrypted_b64 + ':::' + tag_b64
|
|
156
159
|
|
|
157
160
|
def decrypt_data(self, encrypted_data: str) -> Dict[str, any]:
|
|
158
161
|
"""
|
|
159
162
|
解密資料 (AES-256-GCM)
|
|
160
163
|
|
|
161
164
|
Args:
|
|
162
|
-
encrypted_data: AES-GCM
|
|
165
|
+
encrypted_data: AES-GCM 加密的字串 (base64(密文) + ":::" + base64(tag))
|
|
163
166
|
|
|
164
167
|
Returns:
|
|
165
168
|
Dict: 解密後的資料字典
|
|
@@ -168,12 +171,17 @@ class PAYUNiPaymentService:
|
|
|
168
171
|
ValueError: 解密失敗或驗證失敗
|
|
169
172
|
"""
|
|
170
173
|
try:
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
import base64
|
|
175
|
+
# 步驟 1: 分離 base64 編碼的密文和 tag
|
|
176
|
+
parts = encrypted_data.split(':::')
|
|
177
|
+
if len(parts) != 2:
|
|
178
|
+
raise ValueError('格式錯誤: 缺少 ":::" 分隔符')
|
|
173
179
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
encrypted_b64, tag_b64 = parts
|
|
181
|
+
|
|
182
|
+
# 步驟 2: Base64 解碼
|
|
183
|
+
encrypted = base64.b64decode(encrypted_b64)
|
|
184
|
+
tag = base64.b64decode(tag_b64)
|
|
177
185
|
|
|
178
186
|
# 步驟 3: AES-256-GCM 解密並驗證
|
|
179
187
|
decipher = AES.new(self.hash_key, AES.MODE_GCM, nonce=self.hash_iv)
|
|
@@ -204,8 +212,8 @@ class PAYUNiPaymentService:
|
|
|
204
212
|
>>> len(checksum)
|
|
205
213
|
64
|
|
206
214
|
"""
|
|
207
|
-
# 組合字串:
|
|
208
|
-
raw =
|
|
215
|
+
# 組合字串: HashKey + EncryptInfo + HashIV (Key 在前)
|
|
216
|
+
raw = self.hash_key.decode('utf-8') + encrypt_info + self.hash_iv.decode('utf-8')
|
|
209
217
|
|
|
210
218
|
# SHA256 雜湊並轉大寫
|
|
211
219
|
return hashlib.sha256(raw.encode('utf-8')).hexdigest().upper()
|
|
@@ -157,8 +157,8 @@ class PayuniEncryption
|
|
|
157
157
|
16
|
|
158
158
|
);
|
|
159
159
|
|
|
160
|
-
// 3. 組合加密結果 (
|
|
161
|
-
$encryptInfo =
|
|
160
|
+
// 3. 組合加密結果 (base64(密文) + ":::" + base64(tag))
|
|
161
|
+
$encryptInfo = base64_encode($encrypted) . ':::' . base64_encode($tag);
|
|
162
162
|
|
|
163
163
|
return $encryptInfo;
|
|
164
164
|
}
|
|
@@ -168,12 +168,15 @@ class PayuniEncryption
|
|
|
168
168
|
*/
|
|
169
169
|
public function decrypt(string $encryptInfo): array
|
|
170
170
|
{
|
|
171
|
-
// 1.
|
|
172
|
-
$
|
|
171
|
+
// 1. 分離 base64 編碼的密文和 tag
|
|
172
|
+
$parts = explode(':::', $encryptInfo);
|
|
173
|
+
if (count($parts) !== 2) {
|
|
174
|
+
throw new Exception('格式錯誤: 缺少 ":::" 分隔符');
|
|
175
|
+
}
|
|
173
176
|
|
|
174
|
-
// 2.
|
|
175
|
-
$encrypted =
|
|
176
|
-
$tag =
|
|
177
|
+
// 2. Base64 解碼
|
|
178
|
+
$encrypted = base64_decode($parts[0]);
|
|
179
|
+
$tag = base64_decode($parts[1]);
|
|
177
180
|
|
|
178
181
|
// 3. AES-256-GCM 解密
|
|
179
182
|
$decrypted = openssl_decrypt(
|
|
@@ -193,10 +196,11 @@ class PayuniEncryption
|
|
|
193
196
|
|
|
194
197
|
/**
|
|
195
198
|
* 產生 HashInfo (SHA256)
|
|
199
|
+
* 注意: Key 必須在前面 (HashKey + EncryptInfo + HashIV)
|
|
196
200
|
*/
|
|
197
201
|
public function hashInfo(string $encryptInfo): string
|
|
198
202
|
{
|
|
199
|
-
$raw = $
|
|
203
|
+
$raw = $this->merKey . $encryptInfo . $this->merIV;
|
|
200
204
|
return strtoupper(hash('sha256', $raw));
|
|
201
205
|
}
|
|
202
206
|
}
|
|
@@ -219,6 +223,7 @@ class PayuniEncryption:
|
|
|
219
223
|
|
|
220
224
|
def encrypt(self, params: dict) -> str:
|
|
221
225
|
"""AES-256-GCM 加密"""
|
|
226
|
+
import base64
|
|
222
227
|
# 1. 組合 Query String
|
|
223
228
|
query_string = urlencode(params)
|
|
224
229
|
|
|
@@ -226,19 +231,24 @@ class PayuniEncryption:
|
|
|
226
231
|
cipher = AES.new(self.mer_key, AES.MODE_GCM, nonce=self.mer_iv)
|
|
227
232
|
encrypted, tag = cipher.encrypt_and_digest(query_string.encode('utf-8'))
|
|
228
233
|
|
|
229
|
-
# 3. 組合加密結果
|
|
230
|
-
|
|
234
|
+
# 3. 組合加密結果 (base64(密文) + ":::" + base64(tag))
|
|
235
|
+
encrypted_b64 = base64.b64encode(encrypted).decode('utf-8')
|
|
236
|
+
tag_b64 = base64.b64encode(tag).decode('utf-8')
|
|
237
|
+
encrypt_info = encrypted_b64 + ':::' + tag_b64
|
|
231
238
|
|
|
232
239
|
return encrypt_info
|
|
233
240
|
|
|
234
241
|
def decrypt(self, encrypt_info: str) -> dict:
|
|
235
242
|
"""AES-256-GCM 解密"""
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
import base64
|
|
244
|
+
# 1. 分離 base64 編碼的密文和 tag
|
|
245
|
+
parts = encrypt_info.split(':::')
|
|
246
|
+
if len(parts) != 2:
|
|
247
|
+
raise ValueError('格式錯誤: 缺少 ":::" 分隔符')
|
|
238
248
|
|
|
239
|
-
# 2.
|
|
240
|
-
encrypted =
|
|
241
|
-
tag =
|
|
249
|
+
# 2. Base64 解碼
|
|
250
|
+
encrypted = base64.b64decode(parts[0])
|
|
251
|
+
tag = base64.b64decode(parts[1])
|
|
242
252
|
|
|
243
253
|
# 3. AES-256-GCM 解密
|
|
244
254
|
cipher = AES.new(self.mer_key, AES.MODE_GCM, nonce=self.mer_iv)
|
|
@@ -249,8 +259,8 @@ class PayuniEncryption:
|
|
|
249
259
|
return {k: v[0] for k, v in result.items()}
|
|
250
260
|
|
|
251
261
|
def hash_info(self, encrypt_info: str) -> str:
|
|
252
|
-
"""產生 HashInfo (SHA256)"""
|
|
253
|
-
raw =
|
|
262
|
+
"""產生 HashInfo (SHA256) - 注意: Key 必須在前面"""
|
|
263
|
+
raw = self.mer_key.decode() + encrypt_info + self.mer_iv.decode()
|
|
254
264
|
return hashlib.sha256(raw.encode('utf-8')).hexdigest().upper()
|
|
255
265
|
```
|
|
256
266
|
|
|
@@ -929,7 +939,7 @@ echo 'SUCCESS';
|
|
|
929
939
|
**檢查項目**:
|
|
930
940
|
1. Hash Key 和 Hash IV 是否正確
|
|
931
941
|
2. AES-256-GCM 加密是否正確實作
|
|
932
|
-
3. SHA256
|
|
942
|
+
3. **⚠️ SHA256 計算順序**: 必須是 `SHA256(HashKey + EncryptInfo + HashIV)` 而非 `SHA256(EncryptInfo + HashKey + HashIV)` — **Key 必須在前**
|
|
933
943
|
4. 測試/正式環境金鑰是否混用
|
|
934
944
|
|
|
935
945
|
### 訂單編號重複
|
|
@@ -960,7 +970,7 @@ order_id = f"ORD{int(time.time())}{random.randint(100, 999)}"
|
|
|
960
970
|
**檢查項目**:
|
|
961
971
|
1. AES-256-GCM 參數是否正確 (Key 32 bytes, IV 16 bytes)
|
|
962
972
|
2. Tag 長度是否為 16 bytes
|
|
963
|
-
3.
|
|
973
|
+
3. **⚠️ EncryptInfo 格式**: 必須是 `base64(密文) + ":::" + base64(Tag)` 而非 `hex(密文 + tag)` — 密文和 tag **分別 base64 編碼並用 ":::" 分隔**
|
|
964
974
|
|
|
965
975
|
---
|
|
966
976
|
|
|
@@ -38,8 +38,9 @@ CSV_CONFIG = {
|
|
|
38
38
|
},
|
|
39
39
|
'operation': {
|
|
40
40
|
'file': 'operations.csv',
|
|
41
|
-
|
|
42
|
-
'
|
|
41
|
+
# 逐一列出所有 provider 端點欄位,與 field 域同理
|
|
42
|
+
'search_cols': ['operation', 'operation_zh', 'ecpay_endpoint', 'newebpay_endpoint', 'payuni_endpoint', 'smilepay_endpoint', 'pchomepay_endpoint', 'ezpay_endpoint', 'paynow_legacy_endpoint', 'paynow_modern_endpoint', 'opay_endpoint', 'jkopay_endpoint', 'sunpay_endpoint', 'notes'],
|
|
43
|
+
'output_cols': ['operation', 'operation_zh', 'ecpay_endpoint', 'newebpay_endpoint', 'payuni_endpoint', 'smilepay_endpoint', 'pchomepay_endpoint', 'ezpay_endpoint', 'paynow_legacy_endpoint', 'paynow_modern_endpoint', 'opay_endpoint', 'jkopay_endpoint', 'sunpay_endpoint', 'method', 'required_fields', 'notes']
|
|
43
44
|
},
|
|
44
45
|
'error': {
|
|
45
46
|
'file': 'error-codes.csv',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taiwan-payment-skill",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "AI-powered Taiwan Payment Gateway toolkit. Supports 10 providers: ECPay, NewebPay, PAYUNi, SmilePay, PChomePay, ezPay, PayNow, Shopline Payments, LINE Pay v4, and TapPay.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"taiwan",
|