この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Newer Version Available

This content describes an older version of this product. View Latest

GatewayNotificationResponse クラス

支払ゲートウェイが支払プラットフォームに通知を送信すると、プラットフォームはその通知の受信に成功したか失敗したかを示�� GatewayNotificationResponse で応答します。

名前空間

CommercePayments

使用方法

このクラスのインスタンスを作成するとき、CommercePayments 名前空間を指定する必要があります。このクラスのコンストラクタは、引数を取りません。次に例を示します。

CommercePayments.GatewayNotificationResponse gnr = new CommercePayments.GatewayNotificationResponse();

非同期支払ゲートウェイが通知を送信すると、プラットフォームはその通知の受信に成功したか失敗したかを確認する必要があります。支払ゲートウェイアダプタはこのクラスを使用して、ゲートウェイが通知に対して期待する確認応答を作成します。GatewayNotificationResponse は、processNotification メソッドの戻り値の型です。

1commercepayments.GatewayNotificationResponse gnr = new commercepayments.GatewayNotificationResponse();
2if (saveResult.isSuccess()) {
3    system.debug('Notification accepted by platform');
4} else {
5    system.debug('Errors in the result '+ Blob.valueOf(saveResult.getErrorMessage()));
6}
7gnr.setStatusCode(200);
8gnr.setResponseBody(Blob.valueOf('[accepted]'));
9return gnr;

GatewayNotificationResponse のメソッド

GatewayNotificationResponse のメソッドは次のとおりです。

setResponseBody(responseBody)

ゲートウェイへのレスポンスボディを設定します。ゲートウェイによっては、通知が承諾されたかどうかに関係なく、支払プラットフォームが応答を使用して通知を確認することが期待されます。

署名

global void setResponseBody(Blob responseBody)

パラメータ

responseBody
型: Blob
一般的な応答の値には、応答の受信が成功した場合の accepted が含まれます。次に例を示します。
1commercepayments.GatewayNotificationResponse gnr = new commercepayments.GatewayNotificationResponse();
2if (saveResult.isSuccess()) {
3    system.debug('Notification accepted by platform');
4} else {
5    system.debug('Errors in the result '+ Blob.valueOf(saveResult.getErrorMessage()));
6}
7gnr.setStatusCode(200);
8gnr.setResponseBody(Blob.valueOf('[accepted]'));
9return gnr;

戻り値

型: void

setStatusCode(statusCode)

支払プラットフォームの応答通知の一部としてゲートウェイに送信される HTTP 状況コードを設定します。

署名

global void setStatusCode(Integer statusCode)

パラメータ

statusCode
型: Integer
状況コードは、支払プラットフォーム応答の種別によって異なります。ユーザは支払プラットフォームが返す可能性のあるすべての値を考慮して、GatewayNotificationResponse クラスを設定する必要があります。次に例を示します。
1commercepayments.GatewayNotificationResponse gnr = new commercepayments.GatewayNotificationResponse();
2if (saveResult.isSuccess()) {
3    system.debug('Notification accepted by platform');
4} else {
5    system.debug('Errors in the result '+ Blob.valueOf(saveResult.getErrorMessage()));
6}
7gnr.setStatusCode(200);
8gnr.setResponseBody(Blob.valueOf('[accepted]'));
9return gnr;

戻り値

型: void