コントローラー
コントローラーの事前認証統合
以下のコードと図は、コントローラーに基づくSFCCストアフロントにForterカートリッジを事前認証フローに統合するために必要な更新を概説しています。
COPlaceOrder.jsの更新
既存のhandlepayments (order) 関数に次のコードを追加します。COPlaceOrder.jsファイル内:
var argOrderValidate = {
Order: order,
orderValidateAttemptInput: 1
},
forterController = require('int_forter/cartridge/controllers/ForterValidate'),
forterDecision = forterController.ValidateOrder(argOrderValidate);
// in case if no response from Forter, try the call one more time
if (forterDecision.result === false && forterDecision.orderValidateAttemptInput == 2) {
var argOrderValidate = {
Order: order,
orderValidateAttemptInput: 2
},
forterController = require('int_forter/cartridge/controllers/ForterValidate'),
forterDecision = forterController.ValidateOrder(argOrderValidate);
}
if (forterDecision.JsonResponseOutput.processorAction == 'void') {
if (!empty(forterDecision.PlaceOrderError)) {
return {error : true, forterErrorCode : forterDecision.PlaceOrderError};
} else {
return {error : true};
}
} argOrderValidateの配置
以下のスクリーンショットとコメント付きコードは、handlePaymentTransaction関数内でのコードの推奨配置を示しています。
