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

Newer Version Available

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

AuthorizationReversalRequest クラス

サービスコール中に承認取消要求に関する情報をゲートウェイアダプタに送信します。

名前空間

CommercePayments

取消クラスを支払ゲートウェイアダプタに追加します。ゲートウェイの応答で processRequest をコールするときに、使用可能な requestType 値として AuthorizationReversal を追加することをお勧めします。

1global commercepayments.GatewayResponse processRequest(commercepayments.paymentGatewayContext gatewayContext) {
2        commercepayments.RequestType requestType = gatewayContext.getPaymentRequestType();
3        commercepayments.GatewayResponse response;
4        
5        try {
6        //add other requestType values here
7        //..
8        else if (requestType == commercepayments.RequestType.AuthorizationReversal) {
9                response = createAuthReversalResponse((commercepayments.AuthorizationReversalRequest)gatewayContext.getPaymentRequest());}
10        
11        return response;

その後、承認取消要求の金額、ゲートウェイ情報、および Salesforce 結果コードを設定するクラスを追加します。

1global commercepayments.GatewayResponse createAuthReversalResponse(commercepayments.AuthorizationReversalRequest authReversalRequest) {
2        commercepayments.AuthorizationReversalResponse authReversalResponse = new commercepayments.AuthorizationReversalResponse();
3        if(authReversalRequest.amount!=null )
4        {
5            authReversalResponse.setAmount(authReversalRequest.amount);
6        }
7        else
8        {
9             throw new SalesforceValidationException('Required Field Missing : Amount');             
10        }
11   
12        system.debug('Response - success');
13        authReversalResponse.setGatewayDate(system.now());
14        authReversalResponse.setGatewayResultCode('00');
15        authReversalResponse.setGatewayResultCodeDescription('Transaction Normal');
16        authReversalResponse.setGatewayReferenceNumber('SF'+getRandomNumber(6));
17        authReversalResponse.setSalesforceResultCodeInfo(SUCCESS_SALESFORCE_RESULT_CODE_INFO);
18        return authReversalResponse;
19    }

AuthorizationReversalRequest のコンストラクタ

AuthorizationReversalRequest のコンストラクタは次のとおりです。

AuthorizationReversalRequest(amount, authorizationId)

承認取消要求の金額を作成するためのコンストラクタ。このコンストラクタはテストでの使用を目的としており、Apex テストコンテキスト外で使用された場合は例外が発生します。

署名

global AuthorizationReversalRequest(Double amount, String authorizationId)

パラメータ

amount
型: Double
承認取消要求の金額。
authorizationId
型: String
取り消される承認要求。

AuthorizationReversalRequest のプロパティ

AuthorizationReversalRequest のプロパティは次のとおりです。

accountId

承認の取消が実行されたトランザクションの顧客取引先を参照します。

署名

global String accountId {get; set;}

プロパティ値

型: String

amount

承認取消要求の総額。正または負の値になります。

署名

global Double amount {get; set;}

プロパティ値

型: Double

paymentAuthorizationId

取り消される支払承認を参照します。

署名

global String paymentAuthorizationId {get; set;}

プロパティ値

型: String

AuthorizationReversalRequest のメソッド

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

equals(obj)

リスト内の外部オブジェクトの同等性を判断して、AuthorizationReversalRequest 型のリストの整合性を維持します。このメソッドは動的で、Java の equals メソッドに基づきます。

署名

global Boolean equals(Object obj)

パラメータ

obj
型: Object
キーが検証される外部オブジェクト。

戻り値

型: Boolean

hashCode()

リスト内の外部オブジェクトの一意性を判断して、AuthorizationReversalRequest 型のリストの整合性を維持します。

署名

global Integer hashCode()

戻り値

型: Integer

toString()

日付を文字列に変換します。

署名

global String toString()

戻り値

型: String