Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

クレジットカード決済を3Dセキュア2.0に対応する #121

Merged
merged 6 commits into from
Sep 21, 2022

Conversation

uchinokot
Copy link

@uchinokot uchinokot commented Sep 16, 2022

目的

3Dセキュア1.0は2022年10月13日に閉塞されるので、3Dセキュア2.0に対応できるようにします。
変更内容詳細や仕様書はイプシロンからのお知らせにあります。

対応内容は以下です。

  • 通常決済と登録済み課金の場合に3Dセキュア2.0に必要なパラメータを渡せるようにした
    • purchaseregistered_purchase に対応
    • 月次課金( registered_recurring )は3Dセキュア対応のクレジットカードが利用できないので対応していない
  • APIの改修が終わったので registered_purchase のテストも登録済み課金 + 3Dセキュア2.0用のVCRカセットを使用 registered_purchase のテストは一時的に他のVCRカセットを使って追加
    • イプシロンのAPIに不具合があり、APIを叩いても正常なレスポンスが返ってこないので
    • 不具合が改修された後にVCRカセットを取り直す予定 => APIの改修が終わったのでVCRカセットを取り直した
  • READMEに3Dセキュア2.0の場合を追加

Comment on lines +25 to +35
RISK_BASE_AUTH_PARAMS_KEYS = %i[
tds_flag billAddrCity billAddrCountry billAddrLine1 billAddrLine2 billAddrLine3
billAddrPostCode billAddrState shipAddrCity shipAddrCountry shipAddrLine1 shipAddrLine2
shipAddrLine3 shipAddrPostCode shipAddrState chAccAgeInd chAccChange
chAccChangeIndchAccDate chAccPwdChange chAccPwChangeInd nbPurchaseAccount paymentAccAge
paymentAccInd provisionAttemptsDay shipAddressUsage shipAddressUsageInd shipNameIndicator
suspiciousAccActivity txnActivityDay txnActivityYear threeDSReqAuthData threeDSReqAuthMethod
threeDSReqAuthTimestamp addrMatch cardholderName homePhone mobilePhone
workPhone challengeInd deliveryEmailAddress deliveryTimeframe giftCardAmount
giftCardCount preOrderDate preOrderPurchaseInd reorderItemsInd shipIndicator
].freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 網羅できていそう

パラメータ1 パラメータ2
image image

giftCardCount preOrderDate preOrderPurchaseInd reorderItemsInd shipIndicator
].freeze

THREE_D_SECURE_2_INDICATORS = [21, 22].freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 tds_flag は 21 or 22
image

FAILURE = '0'
SUCCESS = '1'
THREE_D_SECURE_1 = '5'
THREE_D_SECURE_2 = '6'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3DS2.0 の場合は 6 が返る
image

Comment on lines +178 to +180
tds_flag: 21 # 21 or 22
# optional:
# add params for risk-based certification(billAddrCity etc...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍

Copy link
Contributor

@ken3ypa ken3ypa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

仕様書の要件を満たしておりよさそうに思いました〜!
LGTMです 👍

params.merge!(detail.slice(*RISK_BASE_AUTH_PARAMS_KEYS).compact)
end

commit(PATHS[:registered_purchase], params)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

値は変わらないのですが、こちらは:purchaseではないでしょうか?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:purchase が正しいですね...!修正します!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正確認しました!ありがとうございます。LGTMです

ku00 and others added 2 commits September 20, 2022 14:52
イプシロンのAPI改修が終わり正常にレスポンスが返ってくるようになったので
Copy link

@akira888 akira888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

取り直したVCRカセットを用いて、テストが成功していることを確認しました。LGTMです!

@@ -5,7 +5,7 @@ http_interactions:
uri: https://secure.epsilon.jp/cgi-bin/order/direct_card_payment.cgi
body:
encoding: UTF-8
string: contract_code=[CONTRACT_CODE]&user_id=U1663229130&user_name=YAMADA+Taro&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O30189731&st_code=10000-0000-0000&mission_code=1&item_price=1000&process_code=1&card_st_code=&pay_time=&tds_check_code=1&user_agent=ActiveMerchant%3A%3AEpsilon-0.13.0&token=03d4a2ce2f747c9223a4ead24888d0293ad26c06273e296f9faa0675f99a1ff7&security_code=&security_check=1&tds_flag=21
string: contract_code=[CONTRACT_CODE]&user_id=124014051&user_name=YAMADA+TARO&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O1663728963&st_code=10000-0000-0000&mission_code=1&item_price=1000&process_code=2&card_st_code=&pay_time=&xml=1&tds_flag=21

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process_code=2で、test_helperの設定した情報でカセットが取り直せていることを確認しました

Copy link
Contributor

@hrysd hrysd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@hrysd hrysd merged commit 116b3af into pepabo:master Sep 21, 2022
@uchinokot uchinokot deleted the support-3ds2.0 branch September 21, 2022 06:04
@uchinokot uchinokot mentioned this pull request Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants