From 68a948ba0d7b87228b35851bc21481666e5d04d5 Mon Sep 17 00:00:00 2001 From: enggar appkey Date: Wed, 2 Nov 2022 15:52:43 +0800 Subject: [PATCH 1/4] wip: add translation for error code --- config/config.php | 10 +- resources/lang/en/error_sbpayment_item.php | 71 ++++++++++ resources/lang/en/error_sbpayment_method.php | 32 +++++ resources/lang/en/error_sbpayment_type.php | 98 +++++++++++++ resources/lang/ja/error_sbpayment_item.php | 71 ++++++++++ resources/lang/ja/error_sbpayment_method.php | 32 +++++ resources/lang/ja/error_sbpayment_type.php | 98 +++++++++++++ resources/views/softbank_cc_token.blade.php | 25 ---- src/Error/PaymentItem.php | 84 +---------- src/Error/PaymentMethod.php | 37 +---- src/Error/PaymentType.php | 141 +------------------ src/LaravelSoftbankServiceProvider.php | 4 +- src/PaymentMethod/SoftbankResponse.php | 10 +- 13 files changed, 418 insertions(+), 295 deletions(-) create mode 100644 resources/lang/en/error_sbpayment_item.php create mode 100644 resources/lang/en/error_sbpayment_method.php create mode 100644 resources/lang/en/error_sbpayment_type.php create mode 100644 resources/lang/ja/error_sbpayment_item.php create mode 100644 resources/lang/ja/error_sbpayment_method.php create mode 100644 resources/lang/ja/error_sbpayment_type.php delete mode 100644 resources/views/softbank_cc_token.blade.php diff --git a/config/config.php b/config/config.php index 96f68cf..4180ad1 100644 --- a/config/config.php +++ b/config/config.php @@ -4,9 +4,9 @@ * You can place your custom package configuration in here. */ return [ - 'merchant_id' => env('SOFTBANK_MERCHANT_ID'), - 'service_id' => env('SOFTBANK_SERVICE_ID'), - 'hash_key' => env('SOFTBANK_HASH_KEY'), - 'api_endpoint' => env('SOFTBANK_API_ENDPOINT', "https://stbfep.sps-system.com/api/xmlapi.do"), - 'token_endpoint' => env('SOFTBANK_TOKEN_ENDPOINT', "https://stbtoken.sps-system.com/sbpstoken/com_sbps_system_token.js") + 'merchant_id' => env('SOFTBANK_MERCHANT_ID'), + 'service_id' => env('SOFTBANK_SERVICE_ID'), + 'hash_key' => env('SOFTBANK_HASH_KEY'), + 'api_endpoint' => env('SOFTBANK_API_ENDPOINT', "https://stbfep.sps-system.com/api/xmlapi.do"), + 'token_endpoint' => env('SOFTBANK_TOKEN_ENDPOINT', "https://stbtoken.sps-system.com/sbpstoken/com_sbps_system_token.js") ]; \ No newline at end of file diff --git a/resources/lang/en/error_sbpayment_item.php b/resources/lang/en/error_sbpayment_item.php new file mode 100644 index 0000000..ccf9b8b --- /dev/null +++ b/resources/lang/en/error_sbpayment_item.php @@ -0,0 +1,71 @@ + [ + "200" => "credit card number", + "201" => "credit card expiration date", + "202" => "Transaction Class", + "203" => "number of divisions", + "204" => "Bonus Combined Times", + "205" => "Credit card information save flag", + "206" => "Remarks 1", + "207" => "Remarks 2 ", + "208" => "Remarks 3", + "209" => "Security Code", + "210" => "Unused error code", + "211" => "Unused error code", + "212" => "Unused error code", + "213" => "Unused error code", + "214" => "Payment information usage specific type", + "215" => "Settlement payment method usage specific type", + "216" => "Return type of input information at payment", + "217" => "Credit card brand return flag", + "218" => "Unused error code", + "219" => "Unused error code", + "220" => "Unused error code", + "221" => "Unused error code", + "222" => "Unused error code", + "223" => "Unused error code", + "224" => "Unused error code", + "225" => "Refund number", + "226" => "Unused error code", + "227" => "token", + "228" => "token key", + "229" => "permanent token ", + "000" => "Unused error code", + ], + + "_" => [ + "000" => "API Request ID", + "001" => "Merchant ID", + "002" => "Service ID", + "003" => "Customer ID ", + "004" => "Purchase ID ", + "005" => "Product ID", + "006" => "product name", + "007" => "tax amount", + "008" => "In ST02, this occurs when parameters are set incorrectly in Sales, Partial Refund", + "009" => "Result notification destination CGI", + "010" => "Free field 1 ", + "011" => "Free field 2 ", + "012" => "Free field 3 ", + "013" => "Billing number branch number", + "014" => "Line number", + "015" => "Line Item ID ", + "016" => "description product name", + "017" => "Item quantity", + "018" => "Line tax amount", + "019" => "detailed amount (including tax) ", + "020" => "settlement type", + "021" => "last billing month", + "022" => "Campaign Type ", + "023" => "request date and time", + "024" => "Request Allowed Time", + "025" => "checksum", + "026" => "Processed SBPS Transaction ID", + "027" => "Occurs only when specifying an invalid tracking ID for processing", + "028" => "3DES encryption flag", + "029" => "Date processed", + "030" => "Occurs only for credit card payments in ST01", + ] +]; \ No newline at end of file diff --git a/resources/lang/en/error_sbpayment_method.php b/resources/lang/en/error_sbpayment_method.php new file mode 100644 index 0000000..e38dc00 --- /dev/null +++ b/resources/lang/en/error_sbpayment_method.php @@ -0,0 +1,32 @@ + "Indicates that an error occurred during credit card payment.", + "305" => "An error occurred with Rakuten Pay (online payment).", + "306" => "Indicates a PayPal payment error.", + "307" => "This indicates that an error occurred in the Yahoo! Wallet digital conversion version.", + "309" => "An error occurred in Recruit Easy Payment.", + "310" => "An error occurred in LINE Pay.", + "311" => "An error has occurred with PayPay (online payment).", + "313" => "An error occurred in the wallet payment service (Type-Y).", + "314" => "An error has occurred in Merpay Net payment.", + "315" => "An error occurred with Amazon Pay.", + "316" => "An error has occurred in Epos Easy Payment.", + "401" => "Indicates an error occurred with d payment (carrier).", + "402" => "Indicates that an error occurred in au Easy Payment.", + "405" => "Indicates that an error occurred in SoftBank Collective Payment (B).", + "406" => "An error has occurred with au PAY (Internet payment).", + "510" => "Indicates an error code for Alipay international payment.", + "513" => "Indicates that an error occurred during JCB PREMO or House Prepaid Payment.", + "514" => "Indicates that an error occurred during UnionPay online payment.", + "601" => "Indicates an error occurred with Apple Pay.", + "604" => "Indicates an error occurred with Google Pay.", + "701" => "Indicates that an error occurred in convenience store payment.", + "702" => "Indicates that an error has occurred in the general transfer settlement.", + "703" => "Indicates a Pay-easy payment error.", + "710" => "Indicates that an error occurred in NP Postpay.", + "805" => "Indicates that an error has occurred in Eikyufumetsu Point payment.", + "806" => "An error occurred in the T point program (online payment).", + "912" => "Indicates an error occurred with the email link type.", + "999" => "Indicates that an error occurred in a common item." +]; diff --git a/resources/lang/en/error_sbpayment_type.php b/resources/lang/en/error_sbpayment_type.php new file mode 100644 index 0000000..a71def3 --- /dev/null +++ b/resources/lang/en/error_sbpayment_type.php @@ -0,0 +1,98 @@ + [ + "20" => "For MG02 only for registration and renewal requests", + "21" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "22" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "23" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "24" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "25" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "26" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "27" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "28" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "29" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "30" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "31" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "32" => "For ST02, this only occurs for confirmation, cancellation and refund requests", + "33" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "34" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "35" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "36" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "37" => "Occurs when an unfair sales request is made", + "38" => "Occurs when an unfair sales request is made", + "39" => "Occurs when an unfair sales request is made", + "40" => "Occurs when an unfair sales request is made", + "41" => "Occurs when an unfair sales request is made", + "42" => "Occurs when an unfair sales request is made", + "43" => "Occurs when requesting an unauthorized or partial refund", + "44" => "Occurs when requesting an unauthorized or partial refund", + "45" => "Occurs when requesting an unauthorized or partial refund", + "46" => "Occurs when requesting an unauthorized or partial refund", + "47" => "Occurs when requesting an unauthorized or partial refund", + "48" => "Unused error code", + "49" => "In case of unfair cancellation or partial refund request", + "50" => "Occurs when an unjustified cancellation request is made", + "51" => "Occurs when an unjustified cancellation request is made", + "52" => "Occurs when an invalid cancellation request is made", + "53" => "Unused error code", + "54" => "Occurs when an unjustified cancellation request is made", + "55" => "unused error code", + "56" => "Refund within an unreasonable period, only for partial refund requests", + "57" => "Occurs only when recurring billing is stopped", + "58" => "Occurs when canceling customer information while using recurring billing ", + "59" => "Please process a refund. Occurs when requesting a refund for an illegal transaction ", + "60" => "Occurs when a confirmation request is made for a transaction in an invalid state", + "61" => "Occurs only for confirmation, cancellation and refund requests in ST02", + "62" => "Unused error code", + "63" => "Occurs only when Authentication Assist is installed in one-time purchase or recurring purchase", + "64" => "Possibility of occurrence only when SmartLink is installed in one-time purchase or continuous purchase", + "65" => "Occurs when the error on the right is returned from the payment company 'G12: Card not usable' ", + "66" => "Occurs when the error on the right is returned from the settlement company 'G30: Transaction decision pending (manned decision)'", + "67" => "Occurs when the error on the right is returned from the settlement company 'G44: Security code error'", + "68" => "Occurs when the error on the right is returned from the settlement company 'G54: 1 account usage or amount error'", + "69" => "Occurs when the error on the right is returned from the settlement company 'G55: Daily limit exceeded' ", + "70" => "Occurs when the error on the right is returned from the settlement company 'G60: Accident card'", + "71" => "Occurs when the error on the right is returned from the settlement company 'G61: invalid card'", + "72" => "Occurs when the error on the right is returned from the settlement company 'G65: Membership number error'", + "73" => "Occurs when the error on the right is returned from the settlement company 'G83: Expiration date error'", + "74" => "Occurs when the error on the right is returned from the settlement company 'G85: Service not covered error'", + "75" => "Occurs when the error on the right is returned from the settlement company (1: Unmatched (collation NG)) ", + "76" => "Occurs when the error on the right is returned from the settlement company (9: Inquiry not possible) ", + "77" => "Occurs when the error on the right is returned from the settlement company (5: Proxy authorization at SLN Center)", + "78" => "Occurs when the credit card information saving flag element is not set correctly for one-time purchase and re-credit.", + "79" => "Occurs when an unfair sales request is made", + "K0" => "Occurs when an unfair partial refund request is made", + "K1" => "The partial refund has been canceled because the total refund amount exceeds the sales amount. Unfair partial refund", + "K2" => "Credit card not accepted (G30: This transaction has been put on hold.) ", + "K3" => "request parameter error", + "K4" => "credit result does not exist error", + "K5" => "Error due to change request for successfully credited transaction", + "W0" => "Occurs when an unfair sales request is made", + "W1" => "Occurs when an unreasonable sales request is made", + "W2" => "Occurs when an unfair refund request is made", + "W3" => "Occurs when an unfair refund request is made", + "W4" => "Occurs when an unfair partial refund request is made", + "W5" => "Occurs when an unfair refund request is made", + "W6" => "Occurs when an unfair cancellation/refund request is made", + ], + + "_" => [ + "80" => "In case of our internal system error", + "81" => "Occurs only in case of validation discrepancies in request parameters internally by our company ", + "82" => "Unused error code", + "83" => "Occurs only when there is no record of the corresponding payment within our company ", + "84" => "Occurs when payment company fails ", + "85" => "Occurs when payment company fails ", + "86" => "In ST02, it occurs only for confirmation, cancellation, and refund requests for credit card payments. In ST02, it occurs for all requests other than credit card payments.", + "90" => "API encountered an unexpected error", + "91" => "Unused error code", + "92" => "Failed to connect to GW", + "93" => "Retry limit exceeded", + "94" => "Payment request not completed", + "95" => "The credit card information registration status is inconsistent with the management request * Credit card information has been registered in the credit card information registration request, etc.", + "96" => "request request with same purchase ID, same invoice number", + "97" => "request request with the same tracking ID to be processed and the same refund serial number", + "98" => "Inconsistent permanent token registration state", + ] +]; \ No newline at end of file diff --git a/resources/lang/ja/error_sbpayment_item.php b/resources/lang/ja/error_sbpayment_item.php new file mode 100644 index 0000000..a221e26 --- /dev/null +++ b/resources/lang/ja/error_sbpayment_item.php @@ -0,0 +1,71 @@ + [ + "200" => "クレジットカード番号 ", + "201" => "クレジットカード有効期限 ", + "202" => "取引区分 ", + "203" => "分割回数 ", + "204" => "ボーナス併用回数 ", + "205" => "クレジットカード情報保存フラグ ", + "206" => "備考欄 1 ", + "207" => "備考欄 2 ", + "208" => "備考欄 3 ", + "209" => "セキュリティコード ", + "210" => "使用していないエラーコード", + "211" => "使用していないエラーコード", + "212" => "使用していないエラーコード", + "213" => "使用していないエラーコード", + "214" => "決済情報使用特定タイプ ", + "215" => "決済支払方法使用特定タイプ ", + "216" => "決済時入力情報返却タイプ ", + "217" => "クレジットカードブランド返却フラグ ", + "218" => "使用していないエラーコード", + "219" => "使用していないエラーコード", + "220" => "使用していないエラーコード", + "221" => "使用していないエラーコード", + "222" => "使用していないエラーコード", + "223" => "使用していないエラーコード", + "224" => "使用していないエラーコード", + "225" => "返金枝番 ", + "226" => "使用していないエラーコード", + "227" => "トークン", + "228" => "トークンキー ", + "229" => "永久トークン ", + "000" => "使用していないエラーコード", + ], + + "_" => [ + "000" => "API リクエスト ID", + "001" => "マーチャント ID", + "002" => "サービス ID", + "003" => "顧客 ID ", + "004" => "購入 ID ", + "005" => "商品 ID ", + "006" => "商品名称 ", + "007" => "税額 ", + "008" => "ST02 では売上、部分返金でパラメーターが正しく設定されていない場合に発生 ", + "009" => "結果通知先 CGI ", + "010" => "自由欄 1 ", + "011" => "自由欄 2 ", + "012" => "自由欄 3 ", + "013" => "請求番号枝番 ", + "014" => "明細行番号 ", + "015" => "明細商品 ID ", + "016" => "明細商品名称 ", + "017" => "明細数量 ", + "018" => "明細税額 ", + "019" => "明細金額(税込) ", + "020" => "決済区分 ", + "021" => "最終課金月 ", + "022" => "キャンペーンタイプ ", + "023" => "リクエスト日時 ", + "024" => "リクエスト許容時間 ", + "025" => "チェックサム ", + "026" => "処理対象 SBPS トランザクション ID ", + "027" => "不当な処理対象トラッキング ID を指定した場合に限り発生 ", + "028" => "3DES 暗号化フラグ", + "029" => "処理日時 ", + "030" => "ST01 ではクレジットカード決済に限り発生 ", + ] +]; \ No newline at end of file diff --git a/resources/lang/ja/error_sbpayment_method.php b/resources/lang/ja/error_sbpayment_method.php new file mode 100644 index 0000000..3d3287c --- /dev/null +++ b/resources/lang/ja/error_sbpayment_method.php @@ -0,0 +1,32 @@ + "クレジットカード決済でエラー発生したことを示します。", + "305" => "楽天ペイ(オンライン決済)でエラー発生したことを示します。", + "306" => "ペイパル決済でエラー発生したことを示します。", + "307" => "Yahoo!ウォレット決済デジコン版でエラー発生したことを示します。 ", + "309" => "リクルートかんたん支払いでエラー発生したことを示します。", + "310" => "LINE Pay でエラー発生したことを示します。", + "311" => "PayPay(オンライン決済)でエラー発生したことを示します。", + "313" => "ウォレット決済サービス(Type-Y)でエラー発生したことを示します。", + "314" => "メルペイネット決済でエラー発生したことを示します。", + "315" => "Amazon Pay でエラー発生したことを示します。", + "316" => "エポスかんたん決済でエラー発生したことを示します。", + "401" => "d 払い(キャリア)でエラー発生したことを示します。", + "402" => "au かんたん決済でエラー発生したことを示します。", + "405" => "ソフトバンクまとめて支払い(B)でエラー発生したことを示します。", + "406" => "au PAY(ネット支払い)でエラー発生したことを示します。 ", + "510" => "Alipay 国際決済でのエラーコードを示します。 ", + "513" => "JCB PREMO 決済・ハウスプリペイド決済でエラー発生したことを示します。", + "514" => "銀聯ネット決済でエラー発生したことを示します。", + "601" => "Apple Pay でエラー発生したことを示します。 ", + "604" => "Google Pay でエラー発生したことを示します。", + "701" => "コンビニ決済でエラー発生したことを示します。", + "702" => "総合振込決済でエラー発生したことを示します。", + "703" => "Pay-easy 決済でエラー発生したことを示します。", + "710" => "NP 後払いでエラー発生したことを示します。", + "805" => "永久不滅ポイント決済でエラー発生したことを示します。", + "806" => "T ポイントプログラム(オンライン決済)でエラー発生したことを示します。", + "912" => "メールリンク型でエラー発生したことを示します。", + "999" => "共通項目でエラー発生したことを示します。 " +]; diff --git a/resources/lang/ja/error_sbpayment_type.php b/resources/lang/ja/error_sbpayment_type.php new file mode 100644 index 0000000..8bb4e35 --- /dev/null +++ b/resources/lang/ja/error_sbpayment_type.php @@ -0,0 +1,98 @@ + [ + "20" => "MG02 では登録、更新要求に限り発生 ", + "21" => "ST02 では確定、取消、返金要求に限り発生 ", + "22" => "ST02 では確定、取消、返金要求に限り発生 ", + "23" => "ST02 では確定、取消、返金要求に限り発生 ", + "24" => "ST02 では確定、取消、返金要求に限り発生 ", + "25" => "ST02 では確定、取消、返金要求に限り発生 ", + "26" => "ST02 では確定、取消、返金要求に限り発生 ", + "27" => "ST02 では確定、取消、返金要求に限り発生 ", + "28" => "ST02 では確定、取消、返金要求に限り発生", + "29" => "ST02 では確定、取消、返金要求に限り発生 ", + "30" => "ST02 では確定、取消、返金要求に限り発生 ", + "31" => "ST02 では確定、取消、返金要求に限り発生 ", + "32" => "ST02 では確定、取消、返金要求に限り発生 ", + "33" => "ST02 では確定、取消、返金要求に限り発生 ", + "34" => "ST02 では確定、取消、返金要求に限り発生 ", + "35" => "ST02 では確定、取消、返金要求に限り発生 ", + "36" => "ST02 では確定、取消、返金要求に限り発生 ", + "37" => "不当な売上要求をした場合に発生 ", + "38" => "不当な売上要求をした場合に発生 ", + "39" => "不当な売上要求をした場合に発生 ", + "40" => "不当な売上要求をした場合に発生 ", + "41" => "不当な売上要求をした場合に発生 ", + "42" => "不当な売上要求をした場合に発生 ", + "43" => "不当な返金、部分返金要求をした場合に発生 ", + "44" => "不当な返金、部分返金要求をした場合に発生 ", + "45" => "不当な返金、部分返金要求をした場合に発生 ", + "46" => "不当な返金、部分返金要求をした場合に発生", + "47" => "不当な返金、部分返金要求をした場合に発生", + "48" => "使用していないエラーコード", + "49" => "不当な取消、部分返金要求をした場合に発生 ", + "50" => "不当な取消要求をした場合に発生 ", + "51" => "不当な取消要求をした場合に発生 ", + "52" => "不当な取消要求をした場合に発生", + "53" => "使用していないエラーコード", + "54" => "不当な取消要求をした場合に発生 ", + "55" => "使用していないエラーコード ", + "56" => "不当な期間での返金、部分返金要求をしたに限り発生 ", + "57" => "継続課金停止に限り発生 ", + "58" => "継続課金を使用中に顧客情報を取消する際に発生 ", + "59" => "返金処理を実施して下さい。 不当な状態のトランザクションに対し返金要求をした場合に発生 ", + "60" => "不当な状態のトランザクションに対し確定要求をした場合に発生 ", + "61" => "ST02 では確定、取消、返金要求に限り発生 ", + "62" => "使用していないエラーコード", + "63" => "都度購入、継続購入にて、認証アシストを導入している場合に限り発生 ", + "64" => "都度購入、継続購入にて、SmartLink を導入している場合に限り発生の可能性 ", + "65" => "決済会社より右記エラーが返却された場合に発生 「G12:カード使用不可」 ", + "66" => "決済会社より右記エラーが返却された場合に発生 「G30:取引判定保留(有人判定)」 ", + "67" => "決済会社より右記エラーが返却された場合に発生 「G44:セキュリティコード誤り」 ", + "68" => "決済会社より右記エラーが返却された場合に発生 「G54:1 口座利用回数または金額 エラー」", + "69" => "決済会社より右記エラーが返却された場合に発生 「G55:1 日限度額オーバー」 ", + "70" => "決済会社より右記エラーが返却された場合に発生 「G60:事故カード」", + "71" => "決済会社より右記エラーが返却された場合に発生 「G61:無効カード」", + "72" => "決済会社より右記エラーが返却された場合に発生 「G65:会員番号エラー」 ", + "73" => "決済会社より右記エラーが返却された場合に発生 「G83:有効期限エラー」 ", + "74" => "決済会社より右記エラーが返却された場合に発生 「G85:サービス対象外エラー」 ", + "75" => "決済会社より右記エラーが返却された場合に発生 (1:アンマッチ(照合 NG)) ", + "76" => "決済会社より右記エラーが返却された場合に発生 (9:照会不可) ", + "77" => "決済会社より右記エラーが返却された場合に発生 (5:SLN センターで代行オーソリを実 施)", + "78" => "都度購入、再与信にて、クレジットカード情報保存フラグエレメントが正しく設定していない 場合に発生 ", + "79" => "不当な売上要求をした場合に発生 ", + "K0" => "不当な部分返金要求をした場合に発生 ", + "K1" => "返金金額の合計が、売上時金額を超えているため、部分返金処理を中止しました。 不当な部分返金", + "K2" => "クレジットカード使用不可(G30:本取引は保留となりました。) ", + "K3" => "リクエストパラメータエラー ", + "K4" => "与信結果が存在しないエラー ", + "K5" => "正常与信済みトランザクションに対する変更要求のためエラー ", + "W0" => "不当な売上要求をした場合に発生 ", + "W1" => "不当な売上要求をした場合に発生 ", + "W2" => "不当な返金要求をした場合に発生 ", + "W3" => "不当な返金要求をした場合に発生 ", + "W4" => "不当な部分返金要求をした場合に発生 ", + "W5" => "不当な返金要求をした場合に発生 ", + "W6" => "不当な取消返金要求をした場合に発生 ", + ], + + "_" => [ + "80" => "当社内部システムエラーの場合に発生", + "81" => "当社内部でリクエストパラメーターでのバリデーション齟齬の場合に限り発生 ", + "82" => "使用していないエラーコード", + "83" => "当社内部で該当決済のレコードが存在しない場合に限り発生 ", + "84" => "決済会社の障害時に発生 ", + "85" => "決済会社の障害時に発生 ", + "86" => "ST02 ではクレジットカード決済の確定、取消、返金要求に限り発生 ST02 ではクレジットカード決済以外の全要求に対して発生 ", + "90" => "API にて想定外のエラーが発生 ", + "91" => "使用していないエラーコード", + "92" => "GW への接続に失敗 ", + "93" => "再入力上限回数超過 ", + "94" => "決済要求が未完了 ", + "95" => "管理要求に対するクレジットカード情報登録状態が不整合 ※クレジットカード情報登録 要求でクレジットカード情報登録済など", + "96" => "同一購入 ID、同一請求番号枝番でのリクエスト要求 ", + "97" => "同一処理対象トラッキング ID、同一返金枝番でのリクエスト要求", + "98" => "永久トークンの登録状態が不整合 ", + ] +]; \ No newline at end of file diff --git a/resources/views/softbank_cc_token.blade.php b/resources/views/softbank_cc_token.blade.php deleted file mode 100644 index e2734d4..0000000 --- a/resources/views/softbank_cc_token.blade.php +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - -
- - - - - diff --git a/src/Error/PaymentItem.php b/src/Error/PaymentItem.php index b59fe08..b264bd4 100644 --- a/src/Error/PaymentItem.php +++ b/src/Error/PaymentItem.php @@ -4,89 +4,9 @@ class PaymentItem { - - private static $paymentItem = [ - "101" => [ - "200" => "Credit Card Number", - "201" => "Credit card expiration date", - "202" => "Transaction classification", - "203" => "Number of divisions", - "204" => "Number of bonus combinations", - "205" => "Credit card information storage flag", - "206" => "Remarks column 1", - "207" => "Remarks column 2", - "208" => "Remarks column 3", - "209" => "Security code", - "210" => "-", - "211" => "-", - "212" => "-", - "213" => "-", - "214" => "Payment information usage specific type", - "215" => "Payment payment method usage specific type", - "216" => "Input information return type at the time of payment", - "217" => "Credit card brand return flag", - "218" => "-", - "219" => "-", - "220" => "-", - "221" => "-", - "222" => "-", - "223" => "-", - "224" => "-", - "225" => "Refund branch number", - "226" => "-", - "227" => "Token", - "228" => "Token key", - "229" => "Permanent token", - "900" => "-", - ] - ]; - - private static $commonItem = [ - "000" => "API request ID", - "001" => "Merchant ID", - "002" => "Service ID", - "003" => "Customer ID", - "004" => "Purchase ID", - "005" => "Product ID", - "006" => "Product name", - "007" => "Tax amount", - "008" => "Amount (tax included)", - "009" => "Result notification destination CGI", - "010" => "Free column 1", - "011" => "Free column 2", - "012" => "Free column 3", - "013" => "Billing number", - "014" => "Line number", - "015" => "Item ID", - "016" => "Item name", - "017" => "Detail quantity", - "018" => "Detailed tax amount", - "019" => "Detailed amount (tax included)", - "020" => "Payment classification", - "021" => "Last billing month", - "022" => "Campaign type", - "023" => "Request date and time", - "024" => "Request permissible time", - "025" => "Hash", - "026" => "SBPS transaction ID to be processed", - "027" => "Processing target tracking ID", - "028" => "3DES encryption flag", - "029" => "Processing date and time", - "030" => "SBPS customer information return flag", - ]; - - public static function parseErrorCode(string $paymentErrCode, string $itemErrCode): string + public static function parseErrorCode(string $code): string { - - if (isset(self::$paymentItem[$paymentErrCode][$itemErrCode])) { - return self::$paymentItem[$paymentErrCode][$itemErrCode]; - } - - if (isset(self::$commonItem[$itemErrCode])) { - return self::$commonItem[$itemErrCode]; - } - - return "Not applicable"; + return $code; } } \ No newline at end of file diff --git a/src/Error/PaymentMethod.php b/src/Error/PaymentMethod.php index 982c2f6..473ee39 100644 --- a/src/Error/PaymentMethod.php +++ b/src/Error/PaymentMethod.php @@ -4,41 +4,8 @@ class PaymentMethod { - - private static $messages = [ - "101" => "Credit Card", - "305" => "Rakuten Pay (Online Payment)", - "306" => "Paypal", - "307" => "Yahoo! Wallet payment Digicon version", - "309" => "Recruit Easy Payment", - "310" => "LINE Pay", - "311" => "PayPay (Online Payment)", - "313" => "Wallet payment service (Type-Y)", - "314" => "Melpay Net Payment", - "315" => "Amazon Pay", - "316" => "Epos Easy Settlement", - "401" => "Docomo Payment (carrier)", - "402" => "au Easy settlement", - "405" => "SoftBank Collective Payment (B)", - "406" => "au PAY (net payment)", - "510" => "Alipay International Payment", - "513" => "JCB PREMO payment / house prepaid payment", - "514" => "UnionPay Net Payment", - "601" => "Apple Pay", - "604" => "Google Pay", - "701" => "Convenience payment", - "702" => "Comprehensive transfer settlement", - "703" => "Pay-easy payment", - "710" => "NP Deferred Payment", - "805" => "Permanent Immortal Point Settlement", - "806" => "T point program (online payment)", - "912" => "Maillink type", - "999" => "Common" - ]; - public static function parseErrorCode(string $code): string { - return self::$messages[$code]; + return $code; } - -} \ No newline at end of file +} diff --git a/src/Error/PaymentType.php b/src/Error/PaymentType.php index a9561e3..4a6853f 100644 --- a/src/Error/PaymentType.php +++ b/src/Error/PaymentType.php @@ -5,145 +5,8 @@ class PaymentType { - - private static $paymentErrorMessage = [ - "101" => [ - "20" => "Credit card fraud card filter error", - "21" => "Credit center error", - "22" => "Credit card usage limit exceeded", - "23" => "Credit card not accepted", - "24" => "Illegal PIN", - "25" => "Exceeded credit card usage limit", - "26" => "Credit card not accepted", - "27" => "Credit card number / expiration date error", - "28" => "Transaction details cannot be handled", - "29" => "Cannot use the specified bonus number of times", - "30" => "Not available for designated bonus month", - "31" => "Specified bonus amount is not available", - "32" => "Not available in the designated payment start month", - "33" => "Cannot be used for the specified number of divisions", - "34" => "Specified installment amount not available", - "35" => "Specified initial payment amount is not available", - "36" => "Other credit errors", - "37" => "No sales request is required because automatic sales are set.", - "38" => "In the case of G formula, please process the sales with a file.", - "39" => "Sales processing has been canceled because there is no credit result.", - "40" => "Sales processing has been canceled because the credit has been cancelled.", - "41" => "Processing has been canceled because sales processing has been completed.", - "42" => "The processing date and time of sales processing is from the credit date3Valid until the end of the month.", - "43" => "In the case of G type, please process the refund with a file.", - "44" => "Refund processing has been canceled because the credit result does not exist.", - "45" => "Refund processing has been canceled because the credit has been cancelled.", - "46" => "Refund processing has been canceled because refund processing has been completed.", - "47" => "Refund processing has been canceled due to continuous billing.", - "48" => "-", - "49" => "Request a refund for automatic sales API", - "50" => "For P expressions, use the refund request API.", - "51" => "The credit cancellation process has been canceled because the credit result does not exist.", - "52" => "Since the credit has been canceled, the credit cancellation process has been cancelled.", - "53" => "-", - "54" => "Credit cancellation processing has been canceled due to continuous billing.", - "55" => "-", - "56" => "Refunds will be processed after the sales date and from the credit cancellation date.3Valid until the end of the month.", - "57" => "The specified renewal billing has already been cancelled.", - "58" => "Continuous billing in-use error", - "59" => "In the case of automatic sales (applying the commit flag), please perform refund processing after executing the commit.", - "60" => "Commit (cancel) cannot be executed because the process has already been completed.", - "61" => "Incorrect security code", - "62" => "-", - "63" => "Authentication assist information required error (SmartLinkTarget when using)", - "64" => "SmartLinkCenter error (SmartLinkTarget when using)", - "65" => "Settlement company judgment error", - "66" => "Settlement company judgment error", - "67" => "Settlement company judgment error", - "68" => "Settlement company judgment error", - "69" => "Settlement company judgment error", - "70" => "Settlement company judgment error", - "71" => "Settlement company judgment error", - "72" => "Settlement company judgment error", - "73" => "Settlement company judgment error", - "74" => "Settlement company judgment error", - "75" => "Settlement company judgment error", - "76" => "Settlement company judgment error", - "77" => "Settlement company judgment error", - "78" => "Credit card information storage flag specification error", - "79" => "Sales processing has been canceled because the specified amount exceeds the credit time amount.", - "K0" => "Partial refund processing has been canceled because sales processing has not been carried out.", - "K1" => "The partial refund process has been canceled because the total refund amount exceeds the sales amount.", - "K2" => "Settlement company judgment error", - "K3" => "Credit card brand return flag specification error", - "K4" => "The credit information change process has been canceled.", - "K5" => "The credit information change process has been canceled.", - "W0" => "Sales processing has been canceled because the cancellation process is already in progress.", - "W1" => "For the processing date and time, specify a date after the credit date.", - "W2" => "Refund processing has been canceled because sales processing has not been carried out.", - "W3" => "Refund processing has been canceled because refund processing is already in progress.", - "W4" => "Refund processing has been canceled because the specified amount exceeds the sales amount.", - "W5" => "For the processing date and time, specify a date after the sales date.", - "W6" => "The cancellation process has been canceled because the cancellation process is already in progress.", - ] - ]; - - private static $commonErrorMessage = [ - "00" => "XML format invalid", - "01" => "Invalid payment method", - "02" => "Invalid API request ID", - "03" => "No value is specified for the required field", - "04" => "Data type other than storable data type is specified", - "05" => "Exceeding data length", - "06" => "Illegal format", - "07" => "Definition value error", - "08" => "-", - "09" => "Invalid request hash value", - "10" => "Submitted request expires (default 10 minutes)", - "11" => "No settlement associated with the specified processing target SBPS transaction ID", - "12" => "No settlement associated with the processing target tracking ID specified in the recredit.", - "13" => "Value is set for a parameter that cannot be specified in recredit.", - "14" => "Merchant ID / service ID does not exist", - ]; - - private static $internalErrorMessage = [ - "80" => "GW system error", - "81" => "API request parameter error", - "82" => "-", - "83" => "GW record search error", - "84" => "Settlement company response parameter error", - "85" => "Settlement company connection error", - "86" => "Settlement company system error", - ]; - - private static $apiErrorMessage = [ - "90" => "API system error", - "91" => "-", - "92" => "GW connection error", - "93" => "Maximum number of re-entry limit error", - "94" => "Settlement incomplete error", - "95" => "Customer information integrity error", - "96" => "Double request error", - "97" => "Double request error (multiple partial refunds)", - "98" => "Permanent token integrity error", - ]; - - public static function parseErrorCode(string $paymentMethodCode, string $paymentTypeCode): string + public static function parseErrorCode(string $code): string { - - if (isset(self::$paymentErrorMessage[$paymentMethodCode][$paymentTypeCode])) { - return self::$paymentErrorMessage[$paymentMethodCode][$paymentTypeCode]; - } - - if (isset(self::$commonErrorMessage[$paymentTypeCode])) { - return self::$commonErrorMessage[$paymentTypeCode]; - } - - if (isset(self::$internalErrorMessage[$paymentTypeCode])) { - return self::$internalErrorMessage[$paymentTypeCode]; - } - - if (isset(self::$apiErrorMessage[$paymentTypeCode])) { - return self::$apiErrorMessage[$paymentTypeCode]; - } - - return 'Unidentified'; - + return $code; } } diff --git a/src/LaravelSoftbankServiceProvider.php b/src/LaravelSoftbankServiceProvider.php index 2c03940..5979f30 100644 --- a/src/LaravelSoftbankServiceProvider.php +++ b/src/LaravelSoftbankServiceProvider.php @@ -35,9 +35,9 @@ public function boot() ], 'assets');*/ // Publishing the translation files. - /*$this->publishes([ + $this->publishes([ __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-softbank'), - ], 'lang');*/ + ], 'lang'); // Registering package commands. // $this->commands([]); diff --git a/src/PaymentMethod/SoftbankResponse.php b/src/PaymentMethod/SoftbankResponse.php index 2c53306..2c0def3 100644 --- a/src/PaymentMethod/SoftbankResponse.php +++ b/src/PaymentMethod/SoftbankResponse.php @@ -110,14 +110,10 @@ public function setResDate($resDate): Response public function getErrorMessages(): ?array { if ($this->getResResult() == 'NG') { - $methodCode = substr($this->getResErrorCode(), 0, 3); - $typeCode = substr($this->getResErrorCode(), 3, 2); - $itemCode = substr($this->getResErrorCode(), 5); - return [ - PaymentMethod::parseErrorCode($methodCode), - PaymentType::parseErrorCode($methodCode, $typeCode), - PaymentItem::parseErrorCode($methodCode, $itemCode) + PaymentMethod::parseErrorCode($this->getResErrorCode()), + PaymentType::parseErrorCode($this->getResErrorCode()), + PaymentItem::parseErrorCode($this->getResErrorCode()) ]; } From f08b9e06b2ddbd8289413cf108c16277acf48414 Mon Sep 17 00:00:00 2001 From: enggar appkey Date: Wed, 2 Nov 2022 16:11:41 +0800 Subject: [PATCH 2/4] wip: load translation on boot app --- src/LaravelSoftbankServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LaravelSoftbankServiceProvider.php b/src/LaravelSoftbankServiceProvider.php index 5979f30..26faa79 100644 --- a/src/LaravelSoftbankServiceProvider.php +++ b/src/LaravelSoftbankServiceProvider.php @@ -14,7 +14,7 @@ public function boot() /* * Optional methods to load your package assets */ - // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-softbank'); + $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-softbank'); // $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-softbank'); // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); // $this->loadRoutesFrom(__DIR__.'/routes.php'); From e0b6e1f6320c1aa18fb7d9b927a81e4408a97788 Mon Sep 17 00:00:00 2001 From: enggar appkey Date: Thu, 3 Nov 2022 09:31:28 +0800 Subject: [PATCH 3/4] wip: add parser error message with localization --- config/config.php | 11 ++++++----- src/Error/PaymentItem.php | 16 ++++++++++++++++ src/Error/PaymentMethod.php | 11 +++++++++++ src/Error/PaymentType.php | 16 ++++++++++++++++ 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/config/config.php b/config/config.php index 4180ad1..7d37aac 100644 --- a/config/config.php +++ b/config/config.php @@ -4,9 +4,10 @@ * You can place your custom package configuration in here. */ return [ - 'merchant_id' => env('SOFTBANK_MERCHANT_ID'), - 'service_id' => env('SOFTBANK_SERVICE_ID'), - 'hash_key' => env('SOFTBANK_HASH_KEY'), - 'api_endpoint' => env('SOFTBANK_API_ENDPOINT', "https://stbfep.sps-system.com/api/xmlapi.do"), - 'token_endpoint' => env('SOFTBANK_TOKEN_ENDPOINT', "https://stbtoken.sps-system.com/sbpstoken/com_sbps_system_token.js") + 'merchant_id' => env('SOFTBANK_MERCHANT_ID'), + 'service_id' => env('SOFTBANK_SERVICE_ID'), + 'hash_key' => env('SOFTBANK_HASH_KEY'), + 'api_endpoint' => env('SOFTBANK_API_ENDPOINT', "https://stbfep.sps-system.com/api/xmlapi.do"), + 'token_endpoint' => env('SOFTBANK_TOKEN_ENDPOINT', "https://stbtoken.sps-system.com/sbpstoken/com_sbps_system_token.js"), + 'error_message_locale' => env('SOFTBANK_ERROR_MESSAGE_LC', 'en'), ]; \ No newline at end of file diff --git a/src/Error/PaymentItem.php b/src/Error/PaymentItem.php index b264bd4..3ff07a6 100644 --- a/src/Error/PaymentItem.php +++ b/src/Error/PaymentItem.php @@ -6,6 +6,22 @@ class PaymentItem { public static function parseErrorCode(string $code): string { + if (strlen($code) >= 8 && function_exists('trans')) { + $errorMessage = sprintf("laravel-softbank::error_sbpayment_item.%s.%s", substr($code, 0, 3), substr($code, 5, 3)); + + if (trans($errorMessage) != $errorMessage) { + return trans($errorMessage, [], config('laravel-softbank.error_message_locale') ?? 'en'); + } + + $fallbackErrorMessage = sprintf("laravel-softbank::error_sbpayment_type._.%s", substr($code, 5, 3)); + + if (trans($fallbackErrorMessage) != $fallbackErrorMessage) { + return trans($fallbackErrorMessage, [], config('laravel-softbank.error_message_locale') ?? 'en'); + } + + return substr($code, 5, 3); + } + return $code; } diff --git a/src/Error/PaymentMethod.php b/src/Error/PaymentMethod.php index 473ee39..e79a2b4 100644 --- a/src/Error/PaymentMethod.php +++ b/src/Error/PaymentMethod.php @@ -6,6 +6,17 @@ class PaymentMethod { public static function parseErrorCode(string $code): string { + + if (strlen($code) >= 3 && function_exists('trans')) { + $errorMessage = sprintf("laravel-softbank::error_sbpayment_method.%s", substr($code, 0, 3)); + + if (trans($errorMessage) != $errorMessage) { + return trans($errorMessage, [], config('laravel-softbank.error_message_locale') ?? 'en'); + } + + return substr($code, 0, 3); + } + return $code; } } diff --git a/src/Error/PaymentType.php b/src/Error/PaymentType.php index 4a6853f..c206f6d 100644 --- a/src/Error/PaymentType.php +++ b/src/Error/PaymentType.php @@ -7,6 +7,22 @@ class PaymentType { public static function parseErrorCode(string $code): string { + if (strlen($code) >= 5 && function_exists('trans')) { + $errorMessage = sprintf("laravel-softbank::error_sbpayment_type.%s.%s", substr($code, 0, 3), substr($code, 3, 2)); + + if (trans($errorMessage) != $errorMessage) { + return trans($errorMessage, [], config('laravel-softbank.error_message_locale') ?? 'en'); + } + + $fallbackErrorMessage = sprintf("laravel-softbank::error_sbpayment_type._.%s", substr($code, 3, 2)); + + if (trans($fallbackErrorMessage) != $fallbackErrorMessage) { + return trans($fallbackErrorMessage, [], config('laravel-softbank.error_message_locale') ?? 'en'); + } + + return substr($code, 3, 2); + } + return $code; } } From 407788645fcc3632e3e6e42a475dece402b5dbb3 Mon Sep 17 00:00:00 2001 From: enggar appkey Date: Thu, 3 Nov 2022 09:40:02 +0800 Subject: [PATCH 4/4] chore: update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d35cc91..9b5a8e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,13 @@ All notable changes to `laravel-softbank` will be documented in this file ## 1.0.0 - 201X-XX-XX - initial release + +## 1.2.0 + +- save card using cust_code +- Get saved card info + +## 1.3.0 + +- Add multi lang error message (support : en and ja) +- Add new config env \ No newline at end of file