GatewayErrorResponse クラス
名前空間
使用方法
GatewayErrorResponse を使用して、支払ゲートウェイアダプターによって送信された���ラー応答に関する情報を保存するオブジェクトを作成します。
例
GatewayResponse は、有効な要求ではなく例外を受信すると、GatewayErrorResponse をコールしてその例外に関する情報を含むエラーオブジェクトを作成します。
1global commercepayments.GatewayResponse processRequest(commercepayments.paymentGatewayContext gatewayContext) {
2 commercepayments.RequestType requestType = gatewayContext.getPaymentRequestType();
3 commercepayments.GatewayResponse response;
4 try {
5 if (requestType == commercepayments.RequestType.Authorize) {
6 response = createAuthResponse((commercepayments.AuthorizationRequest)gatewayContext.getPaymentRequest());
7 } else if (requestType == commercepayments.RequestType.Capture) {
8 response = createCaptureResponse((commercepayments.CaptureRequest)gatewayContext.getPaymentRequest()) ;
9 } else if (requestType == commercepayments.RequestType.ReferencedRefund) {
10 response = createRefundResponse((commercepayments.ReferencedRefundRequest)gatewayContext.getPaymentRequest());
11 }
12 return response;
13 } catch(SalesforceValidationException e) {
14 commercepayments.GatewayErrorResponse error = new commercepayments.GatewayErrorResponse('400', e.getMessage());
15 return error;
16 }
17 }