GatewayResponse インターフェース
汎用の支払ゲートウェイ応答インターフェース。このクラスは、CaptureResponse、AbstractTransactionResponse、および AbstractResponse クラスを拡張し、そのすべてのプロパティを継承します。一意のメソッドまたはパラメーターはありません。
名前空間
GatewayResponse の実装例
これは、commercepayments.GatewayResponse インターフェースの実装例です。
1/**
2 * Abstract function to build gateway response for a Transaction
3 * The input is the response from gateway
4 * It creates and returns GatewayResponse from the HttpResponse
5 */
6 public abstract commercepayments.GatewayResponse buildResponse(HttpResponse response);
7
8 /**
9 * Function to process transaction requests
10 * Steps involved are:
11 * 1. Build HttpRequest with the input Request from gateway context
12 * 2. Send request and get the response from gateway
13 * 3. Parse the response from gateway and return GatewayResponse
14 */
15 public commercepayments.GatewayResponse execute(){
16 HttpRequest req;
17 try{
18 //Building a new request
19 req = buildRequest();
20 } catch(PayeezeValidationException e) {
21 return getValidationExceptionError(e);
22 }
23 commercepayments.PaymentsHttp http = new commercepayments.PaymentsHttp();
24 HttpResponse res = null;
25 try{
26 //Sending the request
27 res = http.send(req);
28 } catch(CalloutException ce) {
29 return getCalloutExceptionError(ce);
30 }
31 try{
32 //Parsing the response from gateway
33 return buildResponse(res);
34 } catch(Exception e) {
35 return getParseExceptionError(e);
36 }
37 }他のコンテキストは、CommercePayments ゲートウェイの参照実装の完全なサンプルゲートウェイアダプターを参照してください。