diff --git a/src/main/java/samples/flex/coreServices/GenerateKey.java b/src/main/java/samples/flex/coreServices/GenerateKey.java index 90f028c..36b1399 100644 --- a/src/main/java/samples/flex/coreServices/GenerateKey.java +++ b/src/main/java/samples/flex/coreServices/GenerateKey.java @@ -8,18 +8,16 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.GeneratePublicKeyRequest; import Model.FlexV1KeysPost200Response ; +import Model.GeneratePublicKeyRequest; public class GenerateKey { - private static String status=null; - private static String responseCode; - public static FlexV1KeysPost200Response response=null; - private static Properties merchantProp; + private FlexV1KeysPost200Response response=null; + private Properties merchantProp; - static GeneratePublicKeyRequest request; - - private static GeneratePublicKeyRequest getRequest() { + private GeneratePublicKeyRequest request; + + private GeneratePublicKeyRequest getRequest() { request = new GeneratePublicKeyRequest(); request.encryptionType("RsaOaep256"); return request; @@ -27,33 +25,37 @@ private static GeneratePublicKeyRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + GenerateKey generateKey=new GenerateKey(); + generateKey.process(); } - public static FlexV1KeysPost200Response process() throws Exception { - + private FlexV1KeysPost200Response process() throws Exception { + String className=GenerateKey.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient=null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - KeyGenerationApi keyGenerationApi = new KeyGenerationApi(); + KeyGenerationApi keyGenerationApi = new KeyGenerationApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = keyGenerationApi.generatePublicKey(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" +responseCode); - System.out.println("Status :" +status); - System.out.println(response); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } diff --git a/src/main/java/samples/flex/coreServices/TokenizeCard.java b/src/main/java/samples/flex/coreServices/TokenizeCard.java index 9126e27..cc602f6 100644 --- a/src/main/java/samples/flex/coreServices/TokenizeCard.java +++ b/src/main/java/samples/flex/coreServices/TokenizeCard.java @@ -24,25 +24,26 @@ import samples.flex.tokenization.VerifyToken; public class TokenizeCard { - private static String status = null; - private static String responseCode; - public static FlexV1TokensPost200Response response = null; + private FlexV1TokensPost200Response response; + + private FlexV1KeysPost200Response keyResponse; - public static FlexV1KeysPost200Response keyResponse; private static Properties merchantProp; @SuppressWarnings("rawtypes") - static Map tokenMap = new HashMap(); + private Map tokenMap = new HashMap(); - static TokenizeRequest request; + private TokenizeRequest request; - private static TokenizeRequest getRequest() throws Exception { + private TokenizeRequest getRequest() throws Exception { request = new TokenizeRequest(); - keyResponse = KeyGenerationNoEnc.process(); + KeyGenerationNoEnc keyGenerationNoEnc=new KeyGenerationNoEnc(); + keyResponse = keyGenerationNoEnc.process(); + if(keyResponse!=null){ request.keyId(keyResponse.getKeyId()); - + } Flexv1tokensCardInfo cardInfo = new Flexv1tokensCardInfo(); cardInfo.cardNumber("5555555555554444"); cardInfo.cardExpirationMonth("03"); @@ -55,28 +56,28 @@ private static TokenizeRequest getRequest() throws Exception { } public static void main(String args[]) throws Exception { - process(); + TokenizeCard tokenizeCard=new TokenizeCard(); + tokenizeCard.process(); } - public static void process() throws Exception { - + public void process() throws Exception { + String className=TokenizeCard.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient=null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - FlexTokenApi tokenizationApi = new FlexTokenApi(); + FlexTokenApi tokenizationApi = new FlexTokenApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = tokenizationApi.tokenize(request); byte[] publicBytes = Base64.decode(keyResponse.getDer().getPublicKey()); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PublicKey pubKey = keyFactory.generatePublic(keySpec); - - FlexToken flexTokenResponseBody = new FlexToken(); flexTokenResponseBody.setKeyId(response.getKeyId()); flexTokenResponseBody.setToken(response.getToken()); @@ -92,17 +93,19 @@ public static void process() throws Exception { VerifyToken verifyToken = new VerifyToken(); verifyToken.verify(pubKey, tokenMap); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" +responseCode); - System.out.println("Status :" +status); - System.out.println("ResponseBody :"+ApiClient.respBody); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code" +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader()+ "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody()+ "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode()+ "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader()+ "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className+ "\n"); } } diff --git a/src/main/java/samples/flex/noEncryptionKeyGeneration/KeyGenerationNoEnc.java b/src/main/java/samples/flex/noEncryptionKeyGeneration/KeyGenerationNoEnc.java index 6260538..ccda781 100644 --- a/src/main/java/samples/flex/noEncryptionKeyGeneration/KeyGenerationNoEnc.java +++ b/src/main/java/samples/flex/noEncryptionKeyGeneration/KeyGenerationNoEnc.java @@ -8,17 +8,16 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.GeneratePublicKeyRequest; import Model.FlexV1KeysPost200Response; +import Model.GeneratePublicKeyRequest; public class KeyGenerationNoEnc { - public static FlexV1KeysPost200Response response = null; - public static String keyId = null; - private static Properties merchantProp; + private FlexV1KeysPost200Response response; + private Properties merchantProp; - static GeneratePublicKeyRequest request; + private GeneratePublicKeyRequest request; - private static GeneratePublicKeyRequest getRequest() { + private GeneratePublicKeyRequest getRequest() { request = new GeneratePublicKeyRequest(); request.encryptionType("None"); return request; @@ -26,27 +25,35 @@ private static GeneratePublicKeyRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + KeyGenerationNoEnc keyGenerationNoEnc=new KeyGenerationNoEnc(); + keyGenerationNoEnc.process(); } - public static FlexV1KeysPost200Response process() throws Exception { - + public FlexV1KeysPost200Response process() throws Exception { + String className=KeyGenerationNoEnc.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient=null; try { request = getRequest(); - /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - KeyGenerationApi keyGenerationApi = new KeyGenerationApi(); + KeyGenerationApi keyGenerationApi = new KeyGenerationApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = keyGenerationApi.generatePublicKey(request); - - System.out.println(ApiClient.respBody); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code" +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } diff --git a/src/main/java/samples/flex/tokenization/VerifyToken.java b/src/main/java/samples/flex/tokenization/VerifyToken.java index c6be12c..f4c1fe4 100644 --- a/src/main/java/samples/flex/tokenization/VerifyToken.java +++ b/src/main/java/samples/flex/tokenization/VerifyToken.java @@ -40,7 +40,6 @@ private static boolean validateTokenSignature(PublicKey publicKey, String signed signInstance.initVerify(publicKey); signInstance.update(signedFields.getBytes()); success = signInstance.verify(Base64.decode(signature)); - System.out.println(success); } catch (IOException e) { throw new FlexEncodingException("Unable to decode signature"+ e); } catch (GeneralSecurityException e) { diff --git a/src/main/java/samples/payments/coreServices/CapturePayment.java b/src/main/java/samples/payments/coreServices/CapturePayment.java index 1094633..28c8c68 100644 --- a/src/main/java/samples/payments/coreServices/CapturePayment.java +++ b/src/main/java/samples/payments/coreServices/CapturePayment.java @@ -19,15 +19,12 @@ public class CapturePayment { - private static String responseCode = null; - private static String status = null; - public static PtsV2PaymentsPost201Response paymentResponse; - public static PtsV2PaymentsCapturesPost201Response response; - private static Properties merchantProp; + private PtsV2PaymentsPost201Response paymentResponse; + private PtsV2PaymentsCapturesPost201Response response; + private Properties merchantProp; + private CapturePaymentRequest request; - static CapturePaymentRequest request; - - private static CapturePaymentRequest getRequest() { + private CapturePaymentRequest getRequest() { request = new CapturePaymentRequest(); Ptsv2paymentsClientReferenceInformation client = new Ptsv2paymentsClientReferenceInformation(); @@ -61,32 +58,40 @@ private static CapturePaymentRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + CapturePayment capturePayment=new CapturePayment(); + capturePayment.process(); } - public static PtsV2PaymentsCapturesPost201Response process() throws Exception { - + public PtsV2PaymentsCapturesPost201Response process() throws Exception { + String className=CapturePayment.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient=new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); + ProcessPayment processPayment = new ProcessPayment(); + paymentResponse = processPayment.process(Boolean.FALSE); - paymentResponse = ProcessPayment.process(false); - CaptureApi captureApi = new CaptureApi(); - response = captureApi.capturePayment(request, paymentResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + if (paymentResponse != null) { + CaptureApi captureApi = new CaptureApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = captureApi.capturePayment(request, paymentResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } diff --git a/src/main/java/samples/payments/coreServices/ProcessAuthorizationReversal.java b/src/main/java/samples/payments/coreServices/ProcessAuthorizationReversal.java index 9305504..4b196df 100644 --- a/src/main/java/samples/payments/coreServices/ProcessAuthorizationReversal.java +++ b/src/main/java/samples/payments/coreServices/ProcessAuthorizationReversal.java @@ -10,22 +10,17 @@ import Invokers.ApiException; import Model.AuthReversalRequest; import Model.PtsV2PaymentsPost201Response; -import Model.PtsV2PaymentsReversalsPost201Response; import Model.Ptsv2paymentsidreversalsClientReferenceInformation; import Model.Ptsv2paymentsidreversalsReversalInformation; import Model.Ptsv2paymentsidreversalsReversalInformationAmountDetails; public class ProcessAuthorizationReversal { - private static String responseCode = null; - private static String status = null; - static PtsV2PaymentsReversalsPost201Response response; - public static PtsV2PaymentsPost201Response paymentResponse; - private static Properties merchantProp; + private PtsV2PaymentsPost201Response paymentResponse; + private Properties merchantProp; + private AuthReversalRequest request; - static AuthReversalRequest request; - - private static AuthReversalRequest getRequest() { + private AuthReversalRequest getRequest() { request = new AuthReversalRequest(); Ptsv2paymentsidreversalsClientReferenceInformation client = new Ptsv2paymentsidreversalsClientReferenceInformation(); @@ -46,34 +41,41 @@ private static AuthReversalRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + ProcessAuthorizationReversal processAuthorizationReversal=new ProcessAuthorizationReversal(); + processAuthorizationReversal.process(); } - private static void process() throws Exception { - + public void process() throws Exception { + String className=ProcessAuthorizationReversal.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); + ProcessPayment processPayment = new ProcessPayment(); + paymentResponse = processPayment.process(false); - paymentResponse = ProcessPayment.process(false); - - ReversalApi reversalApi = new ReversalApi(); - response = reversalApi.authReversal(paymentResponse.getId(), request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + if(paymentResponse!=null){ + ReversalApi reversalApi = new ReversalApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reversalApi.authReversal(paymentResponse.getId(), request); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code" +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payments/coreServices/ProcessCredit.java b/src/main/java/samples/payments/coreServices/ProcessCredit.java index 219bb81..bd2bf90 100644 --- a/src/main/java/samples/payments/coreServices/ProcessCredit.java +++ b/src/main/java/samples/payments/coreServices/ProcessCredit.java @@ -25,14 +25,12 @@ public class ProcessCredit { - private static String responseCode = null; - private static String status = null; - private static PtsV2CreditsPost201Response response; - private static Properties merchantProp; + private PtsV2CreditsPost201Response response; + private Properties merchantProp; - private static CreateCreditRequest request; + private CreateCreditRequest request; - private static CreateCreditRequest getRequest() { + private CreateCreditRequest getRequest() { request = new CreateCreditRequest(); Ptsv2paymentsClientReferenceInformation client = new Ptsv2paymentsClientReferenceInformation(); @@ -112,31 +110,35 @@ private static CreateCreditRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + ProcessCredit processCredit= new ProcessCredit(); + processCredit.process(); } - public static PtsV2CreditsPost201Response process() throws Exception { - + public PtsV2CreditsPost201Response process() throws Exception { + String className=ProcessCredit.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - CreditApi creditApi = new CreditApi(); + CreditApi creditApi = new CreditApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = creditApi.createCredit(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } diff --git a/src/main/java/samples/payments/coreServices/ProcessPayment.java b/src/main/java/samples/payments/coreServices/ProcessPayment.java index 527bde5..5004cca 100644 --- a/src/main/java/samples/payments/coreServices/ProcessPayment.java +++ b/src/main/java/samples/payments/coreServices/ProcessPayment.java @@ -20,15 +20,13 @@ import Model.Ptsv2paymentsProcessingInformation; public class ProcessPayment { - private static String responseCode = null; - private static String status = null; - private static PtsV2PaymentsPost201Response response; - private static boolean capture = false; - private static Properties merchantProp; + private PtsV2PaymentsPost201Response response; + private boolean capture = false; + private Properties merchantProp; - private static CreatePaymentRequest request; + private CreatePaymentRequest request; - private static CreatePaymentRequest getRequest(boolean capture) { + private CreatePaymentRequest getRequest(boolean capture) { request = new CreatePaymentRequest(); Ptsv2paymentsClientReferenceInformation client = new Ptsv2paymentsClientReferenceInformation(); @@ -81,34 +79,40 @@ private static CreatePaymentRequest getRequest(boolean capture) { } public static void main(String args[]) throws Exception { - process(capture); + ProcessPayment processPayment=new ProcessPayment(); + processPayment.process(processPayment.capture); } - public static PtsV2PaymentsPost201Response process(boolean check) throws Exception { - + public PtsV2PaymentsPost201Response process(boolean check) throws Exception { + String className=ProcessPayment.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { capture = check; request = getRequest(capture); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentsApi paymentApi = new PaymentsApi(); + PaymentsApi paymentApi = new PaymentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = paymentApi.createPayment(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } + + } diff --git a/src/main/java/samples/payments/coreServices/RefundCapture.java b/src/main/java/samples/payments/coreServices/RefundCapture.java index 346c59b..b5ca5bd 100644 --- a/src/main/java/samples/payments/coreServices/RefundCapture.java +++ b/src/main/java/samples/payments/coreServices/RefundCapture.java @@ -23,15 +23,12 @@ import Model.RefundCaptureRequest; public class RefundCapture { - private static String responseCode = null; - private static String status = null; - public static PtsV2PaymentsRefundPost201Response response; - public static PtsV2PaymentsCapturesPost201Response captureResponse; - private static Properties merchantProp; + private PtsV2PaymentsRefundPost201Response response; + private PtsV2PaymentsCapturesPost201Response captureResponse; + private Properties merchantProp; + private RefundCaptureRequest request; - static RefundCaptureRequest request; - - private static RefundCaptureRequest getRequest() { + private RefundCaptureRequest getRequest() { request = new RefundCaptureRequest(); Ptsv2paymentsClientReferenceInformation client = new Ptsv2paymentsClientReferenceInformation(); @@ -101,32 +98,39 @@ private static RefundCaptureRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + RefundCapture refundCapture = new RefundCapture(); + refundCapture.process(); } - public static void process() throws Exception { - + public void process() throws Exception { + String className=RefundCapture.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient=new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - captureResponse = CapturePayment.process(); - RefundApi refundApi = new RefundApi(); - response = refundApi.refundCapture(request, captureResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + CapturePayment capturePayment=new CapturePayment(); + captureResponse = capturePayment.process(); + if (captureResponse != null) { + RefundApi refundApi = new RefundApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = refundApi.refundCapture(request, captureResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payments/coreServices/RefundPayment.java b/src/main/java/samples/payments/coreServices/RefundPayment.java index 4ed4b72..7d408a1 100644 --- a/src/main/java/samples/payments/coreServices/RefundPayment.java +++ b/src/main/java/samples/payments/coreServices/RefundPayment.java @@ -16,15 +16,12 @@ import Model.RefundPaymentRequest; public class RefundPayment { - private static String responseCode = null; - private static String status = null; - public static PtsV2PaymentsRefundPost201Response response; - public static PtsV2PaymentsPost201Response paymentResponse; - private static Properties merchantProp; + private PtsV2PaymentsRefundPost201Response response; + private PtsV2PaymentsPost201Response paymentResponse; + private Properties merchantProp; + private RefundPaymentRequest request; - static RefundPaymentRequest request; - - private static RefundPaymentRequest getRequest() { + private RefundPaymentRequest getRequest() { request = new RefundPaymentRequest(); Ptsv2paymentsClientReferenceInformation client = new Ptsv2paymentsClientReferenceInformation(); @@ -44,32 +41,39 @@ private static RefundPaymentRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + RefundPayment refundPayment=new RefundPayment(); + refundPayment.process(); } - public static PtsV2PaymentsRefundPost201Response process() throws Exception { - + public PtsV2PaymentsRefundPost201Response process() throws Exception { + String className=RefundPayment.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - paymentResponse = ProcessPayment.process(true); - RefundApi refundApi = new RefundApi(); - response = refundApi.refundPayment(request, paymentResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + ProcessPayment processPayment = new ProcessPayment(); + paymentResponse = processPayment.process(Boolean.TRUE); + if (paymentResponse != null) { + RefundApi refundApi = new RefundApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = refundApi.refundPayment(request, paymentResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } diff --git a/src/main/java/samples/payments/coreServices/VoidCapture.java b/src/main/java/samples/payments/coreServices/VoidCapture.java index ccd1040..10715f2 100644 --- a/src/main/java/samples/payments/coreServices/VoidCapture.java +++ b/src/main/java/samples/payments/coreServices/VoidCapture.java @@ -15,15 +15,12 @@ public class VoidCapture { - private static String responseCode = null; - private static String status = null; - public static PtsV2PaymentsVoidsPost201Response response; - public static PtsV2PaymentsCapturesPost201Response captureResponse; - private static Properties merchantProp; + private PtsV2PaymentsVoidsPost201Response response; + private PtsV2PaymentsCapturesPost201Response captureResponse; + private Properties merchantProp; + private VoidCaptureRequest request; - static VoidCaptureRequest request; - - private static VoidCaptureRequest getRequest() { + private VoidCaptureRequest getRequest() { request = new VoidCaptureRequest(); Ptsv2paymentsidreversalsClientReferenceInformation client = new Ptsv2paymentsidreversalsClientReferenceInformation(); @@ -35,34 +32,40 @@ private static VoidCaptureRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + VoidCapture voidCapture = new VoidCapture(); + voidCapture.process(); } - public static void process() throws Exception { - + public void process() throws Exception { + String className=VoidCapture.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - captureResponse = CapturePayment.process(); - - VoidApi voidApi = new VoidApi(); - response = voidApi.voidCapture(request, captureResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + CapturePayment capturePayment=new CapturePayment(); + captureResponse = capturePayment.process(); + if (captureResponse != null) { + VoidApi voidApi = new VoidApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = voidApi.voidCapture(request,captureResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payments/coreServices/VoidCredit.java b/src/main/java/samples/payments/coreServices/VoidCredit.java index a048015..69db8ad 100644 --- a/src/main/java/samples/payments/coreServices/VoidCredit.java +++ b/src/main/java/samples/payments/coreServices/VoidCredit.java @@ -15,15 +15,12 @@ public class VoidCredit { - private static String responseCode = null; - private static String status = null; - public static PtsV2PaymentsVoidsPost201Response response; - public static PtsV2CreditsPost201Response creditResponse; - private static Properties merchantProp; + private PtsV2PaymentsVoidsPost201Response response; + private PtsV2CreditsPost201Response creditResponse; + private Properties merchantProp; + private VoidCreditRequest request; - static VoidCreditRequest request; - - private static VoidCreditRequest getRequest() { + private VoidCreditRequest getRequest() { request = new VoidCreditRequest(); Ptsv2paymentsidreversalsClientReferenceInformation client = new Ptsv2paymentsidreversalsClientReferenceInformation(); @@ -35,34 +32,41 @@ private static VoidCreditRequest getRequest() { } public static void main(String args[]) throws Exception { - process(); + VoidCredit voidCredit= new VoidCredit(); + voidCredit.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=VoidCredit.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); + ProcessCredit processCredit = new ProcessCredit(); + creditResponse = processCredit.process(); - creditResponse = ProcessCredit.process(); - - VoidApi voidApi = new VoidApi(); - response = voidApi.voidCredit(request, creditResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + if (creditResponse != null) { + VoidApi voidApi = new VoidApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = voidApi.voidCredit(request, creditResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payments/coreServices/VoidPayment.java b/src/main/java/samples/payments/coreServices/VoidPayment.java index e71ee0c..e9103ac 100644 --- a/src/main/java/samples/payments/coreServices/VoidPayment.java +++ b/src/main/java/samples/payments/coreServices/VoidPayment.java @@ -15,15 +15,12 @@ public class VoidPayment { - private static String responseCode = null; - private static String status = null; - public static PtsV2PaymentsVoidsPost201Response response; - public static PtsV2PaymentsPost201Response paymentResponse; - private static Properties merchantProp; + private PtsV2PaymentsVoidsPost201Response response; + private PtsV2PaymentsPost201Response paymentResponse; + private Properties merchantProp; + private VoidPaymentRequest request; - static VoidPaymentRequest request; - - private static VoidPaymentRequest getRequest() { + private VoidPaymentRequest getRequest() { request = new VoidPaymentRequest(); Ptsv2paymentsidreversalsClientReferenceInformation client = new Ptsv2paymentsidreversalsClientReferenceInformation(); @@ -35,38 +32,41 @@ private static VoidPaymentRequest getRequest() { } public static void main(String args[]) throws Exception { - new VoidPayment(); - } - - public VoidPayment() throws Exception { - process(); + VoidPayment voidPayment = new VoidPayment(); + voidPayment.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=VoidPayment.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); + ProcessPayment processPayment = new ProcessPayment(); + paymentResponse = processPayment.process(true); - paymentResponse = ProcessPayment.process(true); - - VoidApi voidApi = new VoidApi(); - response = voidApi.voidPayment(request, paymentResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + if (paymentResponse != null) { + VoidApi voidApi = new VoidApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = voidApi.voidPayment(request, paymentResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payments/coreServices/VoidRefund.java b/src/main/java/samples/payments/coreServices/VoidRefund.java index d542b7f..660cb76 100644 --- a/src/main/java/samples/payments/coreServices/VoidRefund.java +++ b/src/main/java/samples/payments/coreServices/VoidRefund.java @@ -15,13 +15,11 @@ public class VoidRefund { - private String responseCode = null; - private String status = null; - static PtsV2PaymentsVoidsPost201Response response; - public static PtsV2PaymentsRefundPost201Response refundResponse; - private static Properties merchantProp; + private PtsV2PaymentsVoidsPost201Response response; + private PtsV2PaymentsRefundPost201Response refundResponse; + private Properties merchantProp; - VoidRefundRequest request; + private VoidRefundRequest request; private VoidRefundRequest getRequest() { request = new VoidRefundRequest(); @@ -35,38 +33,43 @@ private VoidRefundRequest getRequest() { } public static void main(String args[]) throws Exception { - new VoidRefund(); + VoidRefund voidRefund =new VoidRefund(); + voidRefund.process(); } - public VoidRefund() throws Exception { - process(); - } - - private void process() throws Exception { + + public void process() throws Exception { + String className=VoidRefund.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - refundResponse = RefundPayment.process(); + RefundPayment refundPayment = new RefundPayment(); + refundResponse = refundPayment.process(); - VoidApi voidApi = new VoidApi(); - response = voidApi.voidRefund(request, refundResponse.getId()); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - + if (refundResponse != null) { + VoidApi voidApi = new VoidApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = voidApi.voidRefund(request, refundResponse.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payouts/Payout.java b/src/main/java/samples/payouts/Payout.java index 04777d4..8b59dbf 100644 --- a/src/main/java/samples/payouts/Payout.java +++ b/src/main/java/samples/payouts/Payout.java @@ -23,13 +23,11 @@ public class Payout { - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private Properties merchantProp; - static PtsV2PayoutsPostResponse request; + private PtsV2PayoutsPostResponse request; - private static PtsV2PayoutsPostResponse getRequest(){ + private PtsV2PayoutsPostResponse getRequest(){ request=new PtsV2PayoutsPostResponse(); PtsV2PaymentsPost201ResponseClientReferenceInformation client = new PtsV2PaymentsPost201ResponseClientReferenceInformation(); @@ -98,34 +96,36 @@ private static PtsV2PayoutsPostResponse getRequest(){ } public static void main(String args[]) throws Exception { - process(); + Payout payout = new Payout(); + payout.process(); } - private static void process() throws Exception { - - try { - request=getRequest(); - - /* Read Merchant details. */ - merchantProp = Configuration.getMerchantDetails(); - MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ProcessAPayoutApi defaultApi=new ProcessAPayoutApi(); - defaultApi.octCreatePayment(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" +responseCode); - System.out.println("Status :" +status); - System.out.println("ResponseBody :"+ApiClient.respBody); - - - - } catch (ApiException e) { - - e.printStackTrace(); + private void process() throws Exception { + String className=Payout.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient=null; + try { + request = getRequest(); + + /* Read Merchant details. */ + merchantProp = Configuration.getMerchantDetails(); + MerchantConfig merchantConfig = new MerchantConfig(merchantProp); + ProcessAPayoutApi defaultApi = new ProcessAPayoutApi(merchantConfig); + apiClient = Invokers.Configuration.getDefaultApiClient(); + defaultApi.octCreatePayment(request); + } catch (ApiException e) { + System.out.println("Exception on calling the Sample Code " + className + ": " + apiClient.getRespBody() + "\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/payouts/coreServices/ProcessPayout.java b/src/main/java/samples/payouts/coreServices/ProcessPayout.java index cb11373..bf202ab 100644 --- a/src/main/java/samples/payouts/coreServices/ProcessPayout.java +++ b/src/main/java/samples/payouts/coreServices/ProcessPayout.java @@ -8,7 +8,6 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Invokers.ApiResponse; import Model.PtsV2PaymentsPost201ResponseClientReferenceInformation; import Model.PtsV2PayoutsPostResponse; import Model.Ptsv2payoutsMerchantInformation; @@ -24,13 +23,11 @@ public class ProcessPayout { - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private Properties merchantProp; - static PtsV2PayoutsPostResponse request; + private PtsV2PayoutsPostResponse request; - private static PtsV2PayoutsPostResponse getRequest() { + private PtsV2PayoutsPostResponse getRequest() { request = new PtsV2PayoutsPostResponse(); PtsV2PaymentsPost201ResponseClientReferenceInformation client = new PtsV2PaymentsPost201ResponseClientReferenceInformation(); @@ -103,31 +100,36 @@ private static PtsV2PayoutsPostResponse getRequest() { } public static void main(String args[]) throws Exception { - process(); + ProcessPayout processPayout = new ProcessPayout(); + processPayout.process(); } - public static void process() throws Exception { - + private void process() throws Exception { + String className=ProcessPayout.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ProcessAPayoutApi payoutApi = new ProcessAPayoutApi(); + ProcessAPayoutApi payoutApi = new ProcessAPayoutApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); payoutApi.octCreatePayment(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/CreateAdhocReport.java b/src/main/java/samples/reporting/coreServices/CreateAdhocReport.java index c37e101..42aaa35 100644 --- a/src/main/java/samples/reporting/coreServices/CreateAdhocReport.java +++ b/src/main/java/samples/reporting/coreServices/CreateAdhocReport.java @@ -13,26 +13,22 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Invokers.ApiResponse; import Model.ReportingV3ReportSubscriptionsGet200ResponseReportPreferences; -import Model.ReportingV3ReportsIdGet200Response; import Model.ReportingV3ReportSubscriptionsGet200ResponseReportPreferences.FieldNameConventionEnum; import Model.RequestBody1; import Model.RequestBody1.ReportMimeTypeEnum; public class CreateAdhocReport { - private static String responseCode = null; - private static String status = null; - private static RequestBody1 request; - private static Properties merchantProp; + private RequestBody1 request; + private Properties merchantProp; - private static RequestBody1 getRequest() { + private RequestBody1 getRequest() { request = new RequestBody1(); request.reportDefinitionName("TransactionRequestClass"); request.timezone("GMT"); request.reportMimeType(ReportMimeTypeEnum.APPLICATION_XML); - request.reportName("testrest dec V70"); + request.reportName("testrest v2 Feb06"); String timeString = "2018-09-02T12:00:00+05:00"; DateTime ddateTime = new DateTime(timeString); @@ -62,31 +58,37 @@ private static RequestBody1 getRequest() { } public static void main(String args[]) throws Exception { - process(); + CreateAdhocReport createAdhocReport = new CreateAdhocReport(); + createAdhocReport.process(); } - public static void process() throws Exception { - + private void process() throws Exception { + String className=CreateAdhocReport.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportsApi ReportsApi = new ReportsApi(); - ApiResponse response = ReportsApi.createReport(request); - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println(ApiClient.responseBody.toString()); + ReportsApi ReportsApi = new ReportsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + ReportsApi.createReport(request); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/CreateReportSubscriptionForReportNameByOrganization.java b/src/main/java/samples/reporting/coreServices/CreateReportSubscriptionForReportNameByOrganization.java index e31d724..455b27c 100644 --- a/src/main/java/samples/reporting/coreServices/CreateReportSubscriptionForReportNameByOrganization.java +++ b/src/main/java/samples/reporting/coreServices/CreateReportSubscriptionForReportNameByOrganization.java @@ -14,12 +14,11 @@ import Model.RequestBody.ReportMimeTypeEnum; public class CreateReportSubscriptionForReportNameByOrganization { - private static String responseCode = null; - private static String status = null; - private static RequestBody request; - private static Properties merchantProp; - private static String report_name = "Dexa"; - private static RequestBody getRequest() { + private RequestBody request; + private Properties merchantProp; + private String reportName = "Dexa"; + + private RequestBody getRequest() { request = new RequestBody(); request.reportDefinitionName("TransactionRequestClass"); @@ -36,39 +35,43 @@ private static RequestBody getRequest() { request.startTime("0950"); request.reportMimeType(ReportMimeTypeEnum.TEXT_CSV); - request.reportName(report_name); + request.reportName(reportName); request.timezone("America/Chicago"); return request; } public static void main(String args[]) throws Exception { - process(); + CreateReportSubscriptionForReportNameByOrganization createReportSubscriptionForReportNameByOrganization = new CreateReportSubscriptionForReportNameByOrganization(); + createReportSubscriptionForReportNameByOrganization.process(); } - public static void process() throws Exception { - + private void process() throws Exception { + String className=CreateReportSubscriptionForReportNameByOrganization.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className + "\n"); + ApiClient apiClient = null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(); + ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); reportSubscriptionsApi.createSubscription(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println(ApiClient.responseBody); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/DeleteSubscriptionOfReportNameByOrganization.java b/src/main/java/samples/reporting/coreServices/DeleteSubscriptionOfReportNameByOrganization.java index a9d4d3b..c6b185c 100644 --- a/src/main/java/samples/reporting/coreServices/DeleteSubscriptionOfReportNameByOrganization.java +++ b/src/main/java/samples/reporting/coreServices/DeleteSubscriptionOfReportNameByOrganization.java @@ -12,36 +12,37 @@ public class DeleteSubscriptionOfReportNameByOrganization { - private static String reportName = "Dexa"; - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private String reportName = "Dexa"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(reportName); + DeleteSubscriptionOfReportNameByOrganization deleteSubscriptionOfReportNameByOrganization = new DeleteSubscriptionOfReportNameByOrganization(); + deleteSubscriptionOfReportNameByOrganization.process(deleteSubscriptionOfReportNameByOrganization.reportName); } - public static void process(String reportName) throws Exception { - - try { - /* Read Merchant details. */ - merchantProp = Configuration.getMerchantDetails(); - MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportSubscriptionsApi reportSubscriptionsApi=new ReportSubscriptionsApi(); - reportSubscriptionsApi.deleteSubscription(reportName); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" +responseCode); - System.out.println("ResponseMessage :" +status); - System.out.println(ApiClient.responseBody); - - } catch (ApiException e) { - - e.printStackTrace(); - } + private void process(String reportName) throws Exception { + String className=DeleteSubscriptionOfReportNameByOrganization.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; + try { + /* Read Merchant details. */ + merchantProp = Configuration.getMerchantDetails(); + MerchantConfig merchantConfig = new MerchantConfig(merchantProp); + ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportSubscriptionsApi.deleteSubscription(reportName); + } catch (ApiException e) { + System.out.println("Exception on calling the Sample Code " + className + ": " + apiClient.getRespBody() + "\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); + } } } diff --git a/src/main/java/samples/reporting/coreServices/DownloadReport.java b/src/main/java/samples/reporting/coreServices/DownloadReport.java index 6c7ed2d..8fb83fa 100644 --- a/src/main/java/samples/reporting/coreServices/DownloadReport.java +++ b/src/main/java/samples/reporting/coreServices/DownloadReport.java @@ -22,34 +22,33 @@ public class DownloadReport { - private static String responseCode = null; - private static String status = null; - private static String responseBody = null; - private static String reportName = "testrest dec V70"; - private static String organizationId = "testrest"; - private static Properties merchantProp; - public static String resourceFile = "DownloadReport"; - private static final String FILE_PATH = "src/test/resources/"; - static LocalDate reportDate = new LocalDate("2018-09-03"); + private String reportName = "testrest v2 Feb06"; + private String organizationId = "testrest"; + private Properties merchantProp; + private String resourceFile = "DownloadReport"; + private final String FILE_PATH = "src/test/resources/"; + private LocalDate reportDate = new LocalDate("2018-09-03"); public static void main(String args[]) throws Exception { - process(); + DownloadReport downloadReport = new DownloadReport(); + downloadReport.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=DownloadReport.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; + String reportType = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - ReportDownloadsApi downloadsApi = new ReportDownloadsApi(); + ReportDownloadsApi downloadsApi = new ReportDownloadsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); downloadsApi.downloadReportWithHttpInfo(reportDate, reportName, organizationId); - - responseBody = ApiClient.responseBody; - InputStream stream = new ByteArrayInputStream(responseBody.getBytes(StandardCharsets.UTF_8)); + InputStream stream = new ByteArrayInputStream(apiClient.getResponseBody().getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); org.apache.commons.io.IOUtils.copy(stream, baos); @@ -57,7 +56,7 @@ private static void process() throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader((new ByteArrayInputStream(bytes)))); String output; - String reportType = "csv"; + reportType = "csv"; while ((output = br.readLine()) != null) { if (output.contains("xml")) { reportType = "xml"; @@ -70,17 +69,19 @@ private static void process() throws Exception { bw.write(output + "\n"); } bw.close(); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); System.out.println("File downloaded at the below location :"); - System.out.println(new File(FILE_PATH + resourceFile + "." + reportType).getAbsolutePath()); - + System.out.println(new File(FILE_PATH + resourceFile + "." + reportType).getAbsolutePath() + "\n"); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getResponseBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetAllSubscriptions.java b/src/main/java/samples/reporting/coreServices/GetAllSubscriptions.java index 7bd1e40..a99f6b5 100644 --- a/src/main/java/samples/reporting/coreServices/GetAllSubscriptions.java +++ b/src/main/java/samples/reporting/coreServices/GetAllSubscriptions.java @@ -8,38 +8,39 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3ReportSubscriptionsGet200Response; public class GetAllSubscriptions { - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetAllSubscriptions getAllSubscriptions = new GetAllSubscriptions(); + getAllSubscriptions.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetAllSubscriptions.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(); - ReportingV3ReportSubscriptionsGet200Response response = reportSubscriptionsApi.getAllSubscriptions(); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); + ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportSubscriptionsApi.getAllSubscriptions(); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetNotificationOfChanges.java b/src/main/java/samples/reporting/coreServices/GetNotificationOfChanges.java index 441d37c..f3376ec 100644 --- a/src/main/java/samples/reporting/coreServices/GetNotificationOfChanges.java +++ b/src/main/java/samples/reporting/coreServices/GetNotificationOfChanges.java @@ -12,47 +12,46 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3NotificationofChangesGet200Response; public class GetNotificationOfChanges { - private static String responseCode = null; - private static String status = null; + private Properties merchantProp; - private static Properties merchantProp; + private String timeString = "2018-02-05T12:00:00-05:00"; + private DateTime ddateTime = new DateTime(timeString); + private DateTime startTime = ddateTime.withZone(DateTimeZone.forID("America/Atikokan")); - private static String timeString = "2018-09-01T12:00:00-05:00"; - private static DateTime ddateTime = new DateTime(timeString); - private static DateTime startTime = ddateTime.withZone(DateTimeZone.forID("America/Atikokan")); - - private static String timeString2 = "2018-05-30T12:00:00-05:00"; - private static DateTime ddateTime2 = new DateTime(timeString2); - private static DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("America/Atikokan")); + private String timeString2 = "2018-02-06T12:00:00-05:00"; + private DateTime ddateTime2 = new DateTime(timeString2); + private DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("America/Atikokan")); public static void main(String args[]) throws Exception { - process(); + GetNotificationOfChanges getNotificationOfChanges = new GetNotificationOfChanges(); + getNotificationOfChanges.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetNotificationOfChanges.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - NotificationOfChangesApi notificationOfChangesApi = new NotificationOfChangesApi(); - System.out.println("startTime :" +startTime + "endTime : "+endTime); - ReportingV3NotificationofChangesGet200Response response = notificationOfChangesApi.getNotificationOfChangeReport(startTime, endTime); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println(response); + NotificationOfChangesApi notificationOfChangesApi = new NotificationOfChangesApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + notificationOfChangesApi.getNotificationOfChangeReport(startTime, endTime); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetPurchaseAndRefundDetails.java b/src/main/java/samples/reporting/coreServices/GetPurchaseAndRefundDetails.java index 7f61c32..25a1685 100644 --- a/src/main/java/samples/reporting/coreServices/GetPurchaseAndRefundDetails.java +++ b/src/main/java/samples/reporting/coreServices/GetPurchaseAndRefundDetails.java @@ -14,49 +14,50 @@ public class GetPurchaseAndRefundDetails { - private static String responseCode = null; - private static String status = null; - - private static String timeString = "2018-09-01T12:00:00+05:00"; - private static DateTime ddateTime = new DateTime(timeString); - private static DateTime startTime = ddateTime.withZone(DateTimeZone.forID("Asia/Ashkhabad")); + private String timeString = "2018-05-01T12:00:00+05:00"; + private DateTime ddateTime = new DateTime(timeString); + private DateTime startTime = ddateTime.withZone(DateTimeZone.forID("Asia/Ashkhabad")); - private static String timeString2 = "2018-05-30T12:00:00-05:00"; - private static DateTime ddateTime2 = new DateTime(timeString2); - private static DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("Asia/Ashkhabad")); + private String timeString2 = "2018-05-30T12:00:00-05:00"; + private DateTime ddateTime2 = new DateTime(timeString2); + private DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("Asia/Ashkhabad")); - private static String organizationId = "testrest"; - private static String groupName = "groupName"; - private static String paymentSubtype = "VI"; - private static String viewBy = "requestDate"; - private static int offSet = 20; - private static int limit = 2000; - private static Properties merchantProp; + private String organizationId = "testrest"; + private String groupName = "groupName"; + private String paymentSubtype = "VI"; + private String viewBy = "requestDate"; + private int offSet = 20; + private int limit = 2000; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetPurchaseAndRefundDetails getPurchaseAndRefundDetails = new GetPurchaseAndRefundDetails(); + getPurchaseAndRefundDetails.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetPurchaseAndRefundDetails.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PurchaseAndRefundDetailsApi purchaseAndRefundDetailsApi = new PurchaseAndRefundDetailsApi(); + PurchaseAndRefundDetailsApi purchaseAndRefundDetailsApi = new PurchaseAndRefundDetailsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); purchaseAndRefundDetailsApi.getPurchaseAndRefundDetails(startTime, endTime, organizationId, paymentSubtype, viewBy, groupName, offSet, limit); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetReportBasedOnReportid.java b/src/main/java/samples/reporting/coreServices/GetReportBasedOnReportid.java index 2bcd91c..cd27f8a 100644 --- a/src/main/java/samples/reporting/coreServices/GetReportBasedOnReportid.java +++ b/src/main/java/samples/reporting/coreServices/GetReportBasedOnReportid.java @@ -8,42 +8,41 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3ReportsIdGet200Response; public class GetReportBasedOnReportid { - private static String responseCode = null; - private static String status = null; - private static String organizationId; - private static String reportId = "79642c43-2368-0cd5-e053-a2588e0a7b3c"; - private static Properties merchantProp; + private String organizationId; + private String reportId = "79642c43-2368-0cd5-e053-a2588e0a7b3c"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetReportBasedOnReportid getReportBasedOnReportid = new GetReportBasedOnReportid(); + getReportBasedOnReportid.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetReportBasedOnReportid.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { - /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportsApi reportsApi = new ReportsApi(); - ReportingV3ReportsIdGet200Response response = reportsApi.getReportByReportId(reportId, organizationId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + ReportsApi reportsApi = new ReportsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportsApi.getReportByReportId(reportId, organizationId); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetReportDefinition.java b/src/main/java/samples/reporting/coreServices/GetReportDefinition.java index bbc9f98..efda92d 100644 --- a/src/main/java/samples/reporting/coreServices/GetReportDefinition.java +++ b/src/main/java/samples/reporting/coreServices/GetReportDefinition.java @@ -8,40 +8,40 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3ReportDefinitionsNameGet200Response; public class GetReportDefinition { - private static String reportDefinitionName = "AcquirerExceptionDetailClass"; - private static String organisationId; - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private String reportDefinitionName = "AcquirerExceptionDetailClass"; + private String organisationId; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetReportDefinition getReportDefinition = new GetReportDefinition(); + getReportDefinition.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetReportDefinition.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportDefinitionsApi reportDefinitionsApi = new ReportDefinitionsApi(); - ReportingV3ReportDefinitionsNameGet200Response response = reportDefinitionsApi.getResourceInfoByReportDefinition(reportDefinitionName, organisationId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + ReportDefinitionsApi reportDefinitionsApi = new ReportDefinitionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportDefinitionsApi.getResourceInfoByReportDefinition(reportDefinitionName, organisationId); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetReportingResourceInformation.java b/src/main/java/samples/reporting/coreServices/GetReportingResourceInformation.java index c0a0182..95ab62b 100644 --- a/src/main/java/samples/reporting/coreServices/GetReportingResourceInformation.java +++ b/src/main/java/samples/reporting/coreServices/GetReportingResourceInformation.java @@ -8,39 +8,39 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3ReportDefinitionsGet200Response; public class GetReportingResourceInformation { - private static String organisationId = "testrest"; - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private String organisationId = "testrest"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetReportingResourceInformation getReportingResourceInformation = new GetReportingResourceInformation(); + getReportingResourceInformation.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetReportingResourceInformation.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportDefinitionsApi reportDefinitionsApi = new ReportDefinitionsApi(); - ReportingV3ReportDefinitionsGet200Response response = reportDefinitionsApi.getResourceV2Info(organisationId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + ReportDefinitionsApi reportDefinitionsApi = new ReportDefinitionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportDefinitionsApi.getResourceV2Info(organisationId); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/reporting/coreServices/GetSubscriptionForReportName.java b/src/main/java/samples/reporting/coreServices/GetSubscriptionForReportName.java index ee53e7b..9bd37e6 100644 --- a/src/main/java/samples/reporting/coreServices/GetSubscriptionForReportName.java +++ b/src/main/java/samples/reporting/coreServices/GetSubscriptionForReportName.java @@ -8,44 +8,41 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3ReportSubscriptionsGet200Response; -import Model.ReportingV3ReportSubscriptionsGet200ResponseSubscriptions; public class GetSubscriptionForReportName { - private static String reportName = "Texture"; - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private String reportName = "Texture"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetSubscriptionForReportName getSubscriptionForReportName = new GetSubscriptionForReportName(); + getSubscriptionForReportName.process(); } - private static void process() throws Exception { - - try { - /* Read Merchant details. */ - merchantProp = Configuration.getMerchantDetails(); - MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(); - ReportingV3ReportSubscriptionsGet200Response response = reportSubscriptionsApi.getSubscription(reportName); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - - - - } catch (ApiException e) { - - e.printStackTrace(); - } + private void process() throws Exception { + String className=GetSubscriptionForReportName.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; + try { + /* Read Merchant details. */ + merchantProp = Configuration.getMerchantDetails(); + MerchantConfig merchantConfig = new MerchantConfig(merchantProp); + ReportSubscriptionsApi reportSubscriptionsApi = new ReportSubscriptionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportSubscriptionsApi.getSubscription(reportName); + } catch (ApiException e) { + System.out.println("Exception on calling the Sample Code " + className + ": " + apiClient.getRespBody() + "\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); + } } } diff --git a/src/main/java/samples/reporting/coreServices/RetrieveAvailableReports.java b/src/main/java/samples/reporting/coreServices/RetrieveAvailableReports.java index c8740cb..f54b76e 100644 --- a/src/main/java/samples/reporting/coreServices/RetrieveAvailableReports.java +++ b/src/main/java/samples/reporting/coreServices/RetrieveAvailableReports.java @@ -11,51 +11,50 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.ReportingV3ReportsGet200Response; public class RetrieveAvailableReports { - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private Properties merchantProp; - private static String timeString="2018-08-02T00:00:00.0Z"; - private static DateTime ddateTime = new DateTime(timeString); - private static DateTime startTime = ddateTime.withZone(DateTimeZone.forID("GMT")); + private String timeString="2018-08-02T00:00:00.0Z"; + private DateTime ddateTime = new DateTime(timeString); + private DateTime startTime = ddateTime.withZone(DateTimeZone.forID("GMT")); - private static String timeString2 = "2018-08-10T23:59:59.0Z"; - private static DateTime ddateTime2 = new DateTime(timeString2); - private static DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("GMT")); + private String timeString2 = "2018-08-10T23:59:59.0Z"; + private DateTime ddateTime2 = new DateTime(timeString2); + private DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("GMT")); - private static String timeQueryType = "executedTime"; - private static String organizationId = "testrest"; + private String timeQueryType = "executedTime"; + private String organizationId = "testrest"; public static void main(String args[]) throws Exception { - process(); + RetrieveAvailableReports retrieveAvailableReports = new RetrieveAvailableReports(); + retrieveAvailableReports.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=RetrieveAvailableReports.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - ReportsApi reportsApi = new ReportsApi(); - ReportingV3ReportsGet200Response response = reportsApi.searchReports(startTime, endTime, timeQueryType, organizationId, null, null, - null, null, null); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + ReportsApi reportsApi = new ReportsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + reportsApi.searchReports(startTime, endTime, timeQueryType, organizationId, null, null,null, null, null); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/secureFileShare/coreServices/DownloadFileWithFileIdentifier.java b/src/main/java/samples/secureFileShare/coreServices/DownloadFileWithFileIdentifier.java index ea1de69..0737da9 100644 --- a/src/main/java/samples/secureFileShare/coreServices/DownloadFileWithFileIdentifier.java +++ b/src/main/java/samples/secureFileShare/coreServices/DownloadFileWithFileIdentifier.java @@ -20,35 +20,31 @@ public class DownloadFileWithFileIdentifier { - private static String responseCode = null; - private static String status = null; - private static String responseBody = null; - - private static String organizationId = "testrest"; - private static Properties merchantProp; - private static String resourceFile = "SecureFile"; + private String organizationId = "testrest"; + private Properties merchantProp; + private String resourceFile = "SecureFile"; private static final String FILE_PATH = "src/test/resources/"; - private static String fileId = "VFJSUmVwb3J0LTc4NTVkMTNmLTkzOTgtNTExMy1lMDUzLWEyNTg4ZTBhNzE5Mi5jc3YtMjAxOC0xMC0yMA=="; + private String fileId = "VFJSUmVwb3J0LTc4NTVkMTNmLTkzOTgtNTExMy1lMDUzLWEyNTg4ZTBhNzE5Mi5jc3YtMjAxOC0xMC0yMA=="; public static void main(String args[]) throws Exception { - process(); + DownloadFileWithFileIdentifier downloadFileWithFileIdentifier = new DownloadFileWithFileIdentifier(); + downloadFileWithFileIdentifier.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=DownloadFileWithFileIdentifier.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - SecureFileShareApi secureFileShareApi = new SecureFileShareApi(); + SecureFileShareApi secureFileShareApi = new SecureFileShareApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); secureFileShareApi.getFileWithHttpInfo(fileId, organizationId); - - responseBody = ApiClient.responseBody; - InputStream stream = new ByteArrayInputStream(responseBody.getBytes(StandardCharsets.UTF_8)); + InputStream stream = new ByteArrayInputStream(apiClient.getResponseBody().getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); org.apache.commons.io.IOUtils.copy(stream, baos); @@ -70,17 +66,19 @@ private static void process() throws Exception { bw.write(output+"\n"); } bw.close(); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("File downloaded at the below location :"); - System.out.println(new File(FILE_PATH + resourceFile + "." + reportType).getAbsolutePath()); - + System.out.println("File downloaded at the below location :"); + System.out.println(new File(FILE_PATH + resourceFile + "." + reportType).getAbsolutePath() + "\n"); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getResponseBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/secureFileShare/coreServices/GetListOfFiles.java b/src/main/java/samples/secureFileShare/coreServices/GetListOfFiles.java index 280b49b..9ad37ee 100644 --- a/src/main/java/samples/secureFileShare/coreServices/GetListOfFiles.java +++ b/src/main/java/samples/secureFileShare/coreServices/GetListOfFiles.java @@ -10,43 +10,43 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.V1FileDetailsGet200Response; public class GetListOfFiles { - private static String responseCode = null; - private static String status = null; - private static String organizationId = "testrest"; - private static Properties merchantProp; + private String organizationId = "testrest"; + private Properties merchantProp; - static LocalDate startDate = new LocalDate("2018-10-20"); - static LocalDate endDate = new LocalDate("2018-10-30"); + private LocalDate startDate = new LocalDate("2018-10-20"); + private LocalDate endDate = new LocalDate("2018-10-30"); public static void main(String args[]) throws Exception { - process(); + GetListOfFiles getListOfFiles = new GetListOfFiles(); + getListOfFiles.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetListOfFiles.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - SecureFileShareApi secureFileShareApi = new SecureFileShareApi(); - V1FileDetailsGet200Response response = secureFileShareApi.getFileDetails(startDate, endDate, organizationId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + SecureFileShareApi secureFileShareApi = new SecureFileShareApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + secureFileShareApi.getFileDetails(startDate, endDate, organizationId); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/tms/coreServices/CreateInstrumentIdentifier.java b/src/main/java/samples/tms/coreServices/CreateInstrumentIdentifier.java index f0d4bec..9ae252e 100644 --- a/src/main/java/samples/tms/coreServices/CreateInstrumentIdentifier.java +++ b/src/main/java/samples/tms/coreServices/CreateInstrumentIdentifier.java @@ -17,15 +17,12 @@ import Model.Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction; public class CreateInstrumentIdentifier { - private static String responseCode = null; - private static String status = null; - static TmsV1InstrumentidentifiersPost200Response response; + private TmsV1InstrumentidentifiersPost200Response response; private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; private static Properties merchantProp; + private Body body; - static Body body; - - private static Body getRequest() { + private Body getRequest() { body = new Body(); Tmsv1instrumentidentifiersCard card = new Tmsv1instrumentidentifiersCard(); @@ -50,31 +47,35 @@ private static Body getRequest() { } public static void main(String args[]) throws Exception { - process(); + CreateInstrumentIdentifier createInstrumentIdentifier = new CreateInstrumentIdentifier(); + createInstrumentIdentifier.process(); } - public static TmsV1InstrumentidentifiersPost200Response process() throws Exception { - + public TmsV1InstrumentidentifiersPost200Response process() throws Exception { + String className=CreateInstrumentIdentifier.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { body = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - InstrumentIdentifiersApi instrumentIdentifierApi = new InstrumentIdentifiersApi(); + InstrumentIdentifiersApi instrumentIdentifierApi = new InstrumentIdentifiersApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = instrumentIdentifierApi.tmsV1InstrumentidentifiersPost(profileId, body); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } return response; } diff --git a/src/main/java/samples/tms/coreServices/CreatePaymentInstrument.java b/src/main/java/samples/tms/coreServices/CreatePaymentInstrument.java index 6665fc6..9ff7dde 100644 --- a/src/main/java/samples/tms/coreServices/CreatePaymentInstrument.java +++ b/src/main/java/samples/tms/coreServices/CreatePaymentInstrument.java @@ -17,15 +17,12 @@ import Model.Tmsv1paymentinstrumentsInstrumentIdentifier; public class CreatePaymentInstrument { - private static String responseCode = null; - private static String status = null; - static TmsV1PaymentinstrumentsPost201Response response; - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static Properties merchantProp; + private TmsV1PaymentinstrumentsPost201Response response; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; + private Body2 body; - static Body2 body; - - private static Body2 getRequest() { + private Body2 getRequest() { body = new Body2(); Tmsv1paymentinstrumentsCard card = new Tmsv1paymentinstrumentsCard(); @@ -60,31 +57,35 @@ private static Body2 getRequest() { } public static void main(String args[]) throws Exception { - process(); + CreatePaymentInstrument createPaymentInstrument = new CreatePaymentInstrument(); + createPaymentInstrument.process(); } - public static TmsV1PaymentinstrumentsPost201Response process() throws Exception { - + public TmsV1PaymentinstrumentsPost201Response process() throws Exception { + String className=CreatePaymentInstrument.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { body = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(); + PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); response = paymentInstrumentApi.tmsV1PaymentinstrumentsPost(profileId, body); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } return response; } diff --git a/src/main/java/samples/tms/coreServices/DeleteInstrumentIdentifier.java b/src/main/java/samples/tms/coreServices/DeleteInstrumentIdentifier.java index faf4759..81f5b97 100644 --- a/src/main/java/samples/tms/coreServices/DeleteInstrumentIdentifier.java +++ b/src/main/java/samples/tms/coreServices/DeleteInstrumentIdentifier.java @@ -8,38 +8,41 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; +import Model.TmsV1InstrumentidentifiersPost200Response; public class DeleteInstrumentIdentifier { - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String tokenId = "7010000000004697654"; - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + DeleteInstrumentIdentifier deleteInstrumentIdentifier = new DeleteInstrumentIdentifier(); + deleteInstrumentIdentifier.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=DeleteInstrumentIdentifier.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - InstrumentIdentifierApi instrumentIdentifierApi = new InstrumentIdentifierApi(); - instrumentIdentifierApi.tmsV1InstrumentidentifiersTokenIdDelete(profileId, tokenId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - + CreateInstrumentIdentifier createInstrumentIdentifier = new CreateInstrumentIdentifier(); + TmsV1InstrumentidentifiersPost200Response response=createInstrumentIdentifier.process(); + if (response != null) { + InstrumentIdentifierApi instrumentIdentifierApi = new InstrumentIdentifierApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + instrumentIdentifierApi.tmsV1InstrumentidentifiersTokenIdDelete(profileId, response.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/tms/coreServices/DeletePaymentInstrument.java b/src/main/java/samples/tms/coreServices/DeletePaymentInstrument.java index a854c80..ac3dd3f 100644 --- a/src/main/java/samples/tms/coreServices/DeletePaymentInstrument.java +++ b/src/main/java/samples/tms/coreServices/DeletePaymentInstrument.java @@ -8,38 +8,41 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; +import Model.TmsV1PaymentinstrumentsPost201Response; public class DeletePaymentInstrument { - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String tokenId = "7D48391D9FA6FD5BE05340588D0AB36B"; - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + DeletePaymentInstrument deletePaymentInstrument = new DeletePaymentInstrument(); + deletePaymentInstrument.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=DeletePaymentInstrument.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(); - paymentInstrumentApi.tmsV1PaymentinstrumentsTokenIdDelete(profileId, tokenId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - + CreatePaymentInstrument createPaymentInstrument = new CreatePaymentInstrument(); + TmsV1PaymentinstrumentsPost201Response response=createPaymentInstrument.process(); + if (response != null) { + PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + paymentInstrumentApi.tmsV1PaymentinstrumentsTokenIdDelete(profileId, response.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/tms/coreServices/RetrieveAllPaymentInstruments.java b/src/main/java/samples/tms/coreServices/RetrieveAllPaymentInstruments.java index 575bcad..27fdefa 100644 --- a/src/main/java/samples/tms/coreServices/RetrieveAllPaymentInstruments.java +++ b/src/main/java/samples/tms/coreServices/RetrieveAllPaymentInstruments.java @@ -8,42 +8,43 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.TmsV1InstrumentidentifiersPaymentinstrumentsGet200Response; import Model.TmsV1InstrumentidentifiersPost200Response; public class RetrieveAllPaymentInstruments { - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String responseCode = null; - private static String status = null; - static TmsV1InstrumentidentifiersPaymentinstrumentsGet200Response response; - private static String tokenId = "7020000000000137654"; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; private static Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + RetrieveAllPaymentInstruments retrieveAllPaymentInstruments = new RetrieveAllPaymentInstruments(); + retrieveAllPaymentInstruments.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=RetrieveAllPaymentInstruments.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentInstrumentsApi paymentInstrumentsApi = new PaymentInstrumentsApi(); - response = paymentInstrumentsApi.tmsV1InstrumentidentifiersTokenIdPaymentinstrumentsGet(profileId, tokenId, null, null); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + CreateInstrumentIdentifier createInstrumentIdentifier = new CreateInstrumentIdentifier(); + TmsV1InstrumentidentifiersPost200Response post200Response=createInstrumentIdentifier.process(); + if (post200Response != null) { + PaymentInstrumentsApi paymentInstrumentsApi = new PaymentInstrumentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + paymentInstrumentsApi.tmsV1InstrumentidentifiersTokenIdPaymentinstrumentsGet(profileId,post200Response.getId(), null, null); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/tms/coreServices/RetrieveInstrumentIdentifier.java b/src/main/java/samples/tms/coreServices/RetrieveInstrumentIdentifier.java index f14cc56..25cdcbb 100644 --- a/src/main/java/samples/tms/coreServices/RetrieveInstrumentIdentifier.java +++ b/src/main/java/samples/tms/coreServices/RetrieveInstrumentIdentifier.java @@ -11,40 +11,41 @@ import Model.TmsV1InstrumentidentifiersPost200Response; public class RetrieveInstrumentIdentifier { - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String tokenId = "7010000000004697654"; - private static String responseCode = null; - private static String status = null; - public static TmsV1InstrumentidentifiersPost200Response response; - private static Properties merchantProp; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + RetrieveInstrumentIdentifier instrumentIdentifier =new RetrieveInstrumentIdentifier(); + instrumentIdentifier.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=RetrieveInstrumentIdentifier.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - InstrumentIdentifierApi instrumentIdentifierApi = new InstrumentIdentifierApi(); - response = instrumentIdentifierApi.tmsV1InstrumentidentifiersTokenIdGet(profileId, tokenId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response); - - + CreateInstrumentIdentifier createInstrumentIdentifier =new CreateInstrumentIdentifier(); + TmsV1InstrumentidentifiersPost200Response post200Response=createInstrumentIdentifier.process(); + if (post200Response != null) { + InstrumentIdentifierApi instrumentIdentifierApi = new InstrumentIdentifierApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + instrumentIdentifierApi.tmsV1InstrumentidentifiersTokenIdGet(profileId, post200Response.getId()); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/tms/coreServices/RetrievePaymentInstrument.java b/src/main/java/samples/tms/coreServices/RetrievePaymentInstrument.java index bf21c2e..577df21 100644 --- a/src/main/java/samples/tms/coreServices/RetrievePaymentInstrument.java +++ b/src/main/java/samples/tms/coreServices/RetrievePaymentInstrument.java @@ -11,40 +11,43 @@ import Model.TmsV1PaymentinstrumentsPost201Response; public class RetrievePaymentInstrument { - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String tokenId = "7BB8C1A9FB273964E05340588D0AE5FB"; - private static String responseCode = null; - private static String status = null; - static TmsV1PaymentinstrumentsPost201Response response; - private static Properties merchantProp; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + RetrievePaymentInstrument retrievePaymentInstrument = new RetrievePaymentInstrument(); + retrievePaymentInstrument.process(); } - private static void process() throws Exception { + private void process() throws Exception { + String className=RetrievePaymentInstrument.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); + try { + /* Read Merchant details. */ + merchantProp = Configuration.getMerchantDetails(); + MerchantConfig merchantConfig = new MerchantConfig(merchantProp); + + CreatePaymentInstrument createPaymentInstrument = new CreatePaymentInstrument(); + TmsV1PaymentinstrumentsPost201Response post201Response = createPaymentInstrument.process(); + if (post201Response != null) { + PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + paymentInstrumentApi.tmsV1PaymentinstrumentsTokenIdGet(profileId, post201Response.getId()); + } + } catch (ApiException e) { + System.out.println("Exception on calling the Sample Code " + className + ": " + apiClient.getRespBody() + "\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); + } - try { - /* Read Merchant details. */ - merchantProp = Configuration.getMerchantDetails(); - MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(); - response=paymentInstrumentApi.tmsV1PaymentinstrumentsTokenIdGet(profileId, tokenId); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" +responseCode); - System.out.println("Status :" +status); - System.out.println("ResponseBody :"+ApiClient.respBody); - - - } catch (ApiException e) { - - e.printStackTrace(); - } } } diff --git a/src/main/java/samples/tms/coreServices/UpdateInstrumentIdentifier.java b/src/main/java/samples/tms/coreServices/UpdateInstrumentIdentifier.java index 5f2da8c..8cda13f 100644 --- a/src/main/java/samples/tms/coreServices/UpdateInstrumentIdentifier.java +++ b/src/main/java/samples/tms/coreServices/UpdateInstrumentIdentifier.java @@ -16,16 +16,12 @@ import Model.Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction; public class UpdateInstrumentIdentifier { - private static String responseCode = null; - private static String status = null; - static TmsV1InstrumentidentifiersPost200Response response; - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String tokenId = "7010000000004697654"; - private static Properties merchantProp; + private TmsV1InstrumentidentifiersPost200Response response; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; + private Body1 body; - static Body1 body; - - private static Body1 getRequest() { + private Body1 getRequest() { body = new Body1(); Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction merchantInitiatedTransaction = new Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction(); @@ -46,32 +42,41 @@ private static Body1 getRequest() { } public static void main(String args[]) throws Exception { - process(); + UpdateInstrumentIdentifier updateInstrumentIdentifier = new UpdateInstrumentIdentifier(); + updateInstrumentIdentifier.process(); } - public static TmsV1InstrumentidentifiersPost200Response process() throws Exception { - + private TmsV1InstrumentidentifiersPost200Response process() throws Exception { + String className=UpdateInstrumentIdentifier.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { body = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - InstrumentIdentifierApi instrumentIdentifierApi = new InstrumentIdentifierApi(); - response = instrumentIdentifierApi.tmsV1InstrumentidentifiersTokenIdPatch(profileId, tokenId, body); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response.toString()); - + CreateInstrumentIdentifier createInstrumentIdentifier = new CreateInstrumentIdentifier(); + TmsV1InstrumentidentifiersPost200Response post200Response=createInstrumentIdentifier.process(); + if (post200Response != null) { + InstrumentIdentifierApi instrumentIdentifierApi = new InstrumentIdentifierApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = instrumentIdentifierApi.tmsV1InstrumentidentifiersTokenIdPatch(profileId, post200Response.getId(), body); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody()+ "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } + return response; } diff --git a/src/main/java/samples/tms/coreServices/UpdatePaymentInstrument.java b/src/main/java/samples/tms/coreServices/UpdatePaymentInstrument.java index 59fb20b..8120e43 100644 --- a/src/main/java/samples/tms/coreServices/UpdatePaymentInstrument.java +++ b/src/main/java/samples/tms/coreServices/UpdatePaymentInstrument.java @@ -17,17 +17,12 @@ import Model.Tmsv1paymentinstrumentsInstrumentIdentifier; public class UpdatePaymentInstrument { - private static String responseCode = null; - private static String status = null; - static TmsV1PaymentinstrumentsPost201Response response; - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static String tokenId = "79AB33E6A3DE03B6E05340588D0A4B9A"; + private TmsV1PaymentinstrumentsPost201Response response; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private Properties merchantProp; + private Body3 body; - private static Properties merchantProp; - - static Body3 body; - - private static Body3 getRequest() { + private Body3 getRequest() { body = new Body3(); Tmsv1paymentinstrumentsCard card = new Tmsv1paymentinstrumentsCard(); @@ -62,31 +57,39 @@ private static Body3 getRequest() { } public static void main(String args[]) throws Exception { - process(); + UpdatePaymentInstrument updatePaymentInstrument = new UpdatePaymentInstrument(); + updatePaymentInstrument.process(); } - public static TmsV1PaymentinstrumentsPost201Response process() throws Exception { - + private TmsV1PaymentinstrumentsPost201Response process() throws Exception { + String className=UpdatePaymentInstrument.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = new ApiClient(); try { body = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(); - response = paymentInstrumentApi.tmsV1PaymentinstrumentsTokenIdPatch(profileId, tokenId, body); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + CreatePaymentInstrument createPaymentInstrument = new CreatePaymentInstrument(); + TmsV1PaymentinstrumentsPost201Response post201Response=createPaymentInstrument.process(); + if (post201Response != null) { + PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = paymentInstrumentApi.tmsV1PaymentinstrumentsTokenIdPatch(profileId, post201Response.getId(), body); + } } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } return response; } diff --git a/src/main/java/samples/tms/paymentsWithToken/CreateInstrumentIdentifier.java b/src/main/java/samples/tms/paymentsWithToken/CreateInstrumentIdentifier.java index 5418ed4..d1ddc86 100644 --- a/src/main/java/samples/tms/paymentsWithToken/CreateInstrumentIdentifier.java +++ b/src/main/java/samples/tms/paymentsWithToken/CreateInstrumentIdentifier.java @@ -9,7 +9,6 @@ import Invokers.ApiClient; import Invokers.ApiException; import Model.Body; -import Model.TmsV1InstrumentidentifiersPost200Response; import Model.Tmsv1instrumentidentifiersCard; import Model.Tmsv1instrumentidentifiersProcessingInformation; import Model.Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptions; @@ -17,15 +16,12 @@ import Model.Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction; public class CreateInstrumentIdentifier { - private static String responseCode = null; - private static String status = null; - static TmsV1InstrumentidentifiersPost200Response response; - private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; + private String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; - private static Properties merchantProp; - static Body body; + private Properties merchantProp; + private Body body; - private static Body getRequest() { + private Body getRequest() { body = new Body(); Tmsv1instrumentidentifiersCard card = new Tmsv1instrumentidentifiersCard(); @@ -50,31 +46,35 @@ private static Body getRequest() { } public static void main(String args[]) throws Exception { - process(); + CreateInstrumentIdentifier createInstrumentIdentifier = new CreateInstrumentIdentifier(); + createInstrumentIdentifier.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=CreateInstrumentIdentifier.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { body = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - InstrumentIdentifiersApi instrumentIdentifierApi = new InstrumentIdentifiersApi(); - response = instrumentIdentifierApi.tmsV1InstrumentidentifiersPost(profileId, body); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("Status :" + status); - System.out.println(response.getId()); - + InstrumentIdentifiersApi instrumentIdentifierApi = new InstrumentIdentifiersApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + instrumentIdentifierApi.tmsV1InstrumentidentifiersPost(profileId, body); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/tms/paymentsWithToken/PaymentsInstrumentsForAuthorization.java b/src/main/java/samples/tms/paymentsWithToken/PaymentsInstrumentsForAuthorization.java index 4af62ee..96e031a 100644 --- a/src/main/java/samples/tms/paymentsWithToken/PaymentsInstrumentsForAuthorization.java +++ b/src/main/java/samples/tms/paymentsWithToken/PaymentsInstrumentsForAuthorization.java @@ -9,7 +9,6 @@ import Invokers.ApiClient; import Invokers.ApiException; import Model.Body2; -import Model.TmsV1PaymentinstrumentsPost201Response; import Model.Tmsv1instrumentidentifiersCard; import Model.Tmsv1paymentinstrumentsBillTo; import Model.Tmsv1paymentinstrumentsCard; @@ -17,15 +16,11 @@ import Model.Tmsv1paymentinstrumentsInstrumentIdentifier; public class PaymentsInstrumentsForAuthorization { - private static String responseCode = null; - private static String status = null; - static TmsV1PaymentinstrumentsPost201Response response; private static String profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1"; private static Properties merchantProp; + private Body2 body; - static Body2 body; - - private static Body2 getRequest() { + private Body2 getRequest() { body = new Body2(); Tmsv1paymentinstrumentsCard card=new Tmsv1paymentinstrumentsCard(); @@ -60,33 +55,36 @@ private static Body2 getRequest() { } public static void main(String args[]) throws Exception { - process(); + PaymentsInstrumentsForAuthorization paymentsInstrumentsForAuthorization = new PaymentsInstrumentsForAuthorization(); + paymentsInstrumentsForAuthorization.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=PaymentsInstrumentsForAuthorization.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { body = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(); - response = paymentInstrumentApi.tmsV1PaymentinstrumentsPost(profileId, body); - - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" +responseCode); - System.out.println("Status :" +status); - System.out.println(response.getId()); - + PaymentInstrumentsApi paymentInstrumentApi = new PaymentInstrumentsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + paymentInstrumentApi.tmsV1PaymentinstrumentsPost(profileId, body); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/transactionBatches/coreServices/GetIndividualBatchFile.java b/src/main/java/samples/transactionBatches/coreServices/GetIndividualBatchFile.java index c0cc309..66292a4 100644 --- a/src/main/java/samples/transactionBatches/coreServices/GetIndividualBatchFile.java +++ b/src/main/java/samples/transactionBatches/coreServices/GetIndividualBatchFile.java @@ -8,40 +8,39 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Invokers.ApiResponse; -import Model.PtsV1TransactionBatchesGet200Response; public class GetIndividualBatchFile { - private static String responseCode = null; - private static String status = null; - private static String id = "Owcyk6pl"; - private static Properties merchantProp; + private String id = "Owcyk6pl"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetIndividualBatchFile getIndividualBatchFile = new GetIndividualBatchFile(); + getIndividualBatchFile.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetIndividualBatchFile.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - TransactionBatchApi transactionBatchApi = new TransactionBatchApi(); - ApiResponse response = transactionBatchApi.ptsV1TransactionBatchesIdGet(id); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println(ApiClient.respBody); - + TransactionBatchApi transactionBatchApi = new TransactionBatchApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + transactionBatchApi.ptsV1TransactionBatchesIdGet(id); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/transactionBatches/coreServices/GetListOfBatchFiles.java b/src/main/java/samples/transactionBatches/coreServices/GetListOfBatchFiles.java index de43a41..3bbf1ab 100644 --- a/src/main/java/samples/transactionBatches/coreServices/GetListOfBatchFiles.java +++ b/src/main/java/samples/transactionBatches/coreServices/GetListOfBatchFiles.java @@ -11,46 +11,46 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.PtsV1TransactionBatchesGet200Response; public class GetListOfBatchFiles { - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private Properties merchantProp; - private static String timeString = "2018-10-01T00:00:00.00Z"; - private static DateTime ddateTime = new DateTime(timeString); - private static DateTime startTime = ddateTime.withZone(DateTimeZone.forID("GMT")); + private String timeString = "2018-10-01T00:00:00.00Z"; + private DateTime ddateTime = new DateTime(timeString); + private DateTime startTime = ddateTime.withZone(DateTimeZone.forID("GMT")); - private static String timeString2 = "2018-10-31T23:59:59.59Z"; - private static DateTime ddateTime2 = new DateTime(timeString2); - private static DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("GMT")); + private String timeString2 = "2018-10-31T23:59:59.59Z"; + private DateTime ddateTime2 = new DateTime(timeString2); + private DateTime endTime = ddateTime2.withZone(DateTimeZone.forID("GMT")); public static void main(String args[]) throws Exception { - process(); + GetListOfBatchFiles getListOfBatchFiles = new GetListOfBatchFiles(); + getListOfBatchFiles.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetListOfBatchFiles.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - TransactionBatchesApi transactionBatchApi = new TransactionBatchesApi(); - PtsV1TransactionBatchesGet200Response response = transactionBatchApi.ptsV1TransactionBatchesGet(startTime, endTime); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println(response); - + TransactionBatchesApi transactionBatchApi = new TransactionBatchesApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + transactionBatchApi.ptsV1TransactionBatchesGet(startTime, endTime); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } } diff --git a/src/main/java/samples/transactionDetails/coreServices/RetrieveTransaction.java b/src/main/java/samples/transactionDetails/coreServices/RetrieveTransaction.java index 6b94514..9e33583 100644 --- a/src/main/java/samples/transactionDetails/coreServices/RetrieveTransaction.java +++ b/src/main/java/samples/transactionDetails/coreServices/RetrieveTransaction.java @@ -8,39 +8,39 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.TssV2TransactionsGet200Response; public class RetrieveTransaction { - private static String responseCode = null; - private static String status = null; - private static String id = "5422054956856755003002"; - private static Properties merchantProp; + private String id = "5422054956856755003002"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + RetrieveTransaction retrieveTransaction = new RetrieveTransaction(); + retrieveTransaction.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=RetrieveTransaction.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - TransactionDetailsApi transactionDetailsApi = new TransactionDetailsApi(); - TssV2TransactionsGet200Response respose = transactionDetailsApi.getTransaction(id); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println(respose); - + TransactionDetailsApi transactionDetailsApi = new TransactionDetailsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + transactionDetailsApi.getTransaction(id); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className); } } diff --git a/src/main/java/samples/transactionSearch/coreServices/CreateSearch.java b/src/main/java/samples/transactionSearch/coreServices/CreateSearch.java index 485cbb5..57d6bf6 100644 --- a/src/main/java/samples/transactionSearch/coreServices/CreateSearch.java +++ b/src/main/java/samples/transactionSearch/coreServices/CreateSearch.java @@ -12,54 +12,57 @@ import Model.TssV2TransactionsPost201Response; public class CreateSearch { - private static String responseCode = null; - private static String status = null; - private static TssV2TransactionsPost201Response reponse; - private static TssV2TransactionsPostResponse request; - private static Properties merchantProp; + private TssV2TransactionsPost201Response response; + private TssV2TransactionsPostResponse request; + private Properties merchantProp; - private static TssV2TransactionsPostResponse getRequest() { + private TssV2TransactionsPostResponse getRequest() { request = new TssV2TransactionsPostResponse(); request.save(false); - request.name("MRN"); + request.name("TSS search"); request.timezone("America/Chicago"); - request.query("clientReferenceInformation.code:TC50171_3"); + request.query("clientReferenceInformation.code:12345"); request.offset(0); - request.limit(80); + request.limit(100); request.sort("id:asc, submitTimeUtc:asc"); return request; } public static void main(String args[]) throws Exception { - process(); + CreateSearch createSearch = new CreateSearch(); + createSearch.process(); } - public static TssV2TransactionsPost201Response process() throws Exception { - + private TssV2TransactionsPost201Response process() throws Exception { + String className=CreateSearch.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { request = getRequest(); /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - SearchTransactionsApi searchTransactionsApi = new SearchTransactionsApi(); - reponse = searchTransactionsApi.createSearch(request); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + SearchTransactionsApi searchTransactionsApi = new SearchTransactionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + response = searchTransactionsApi.createSearch(request); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API REQUEST BODY:"); + System.out.println(apiClient.getRequestBody() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } - return reponse; + return response; } } diff --git a/src/main/java/samples/transactionSearch/coreServices/GetSearchResults.java b/src/main/java/samples/transactionSearch/coreServices/GetSearchResults.java index f635668..329828f 100644 --- a/src/main/java/samples/transactionSearch/coreServices/GetSearchResults.java +++ b/src/main/java/samples/transactionSearch/coreServices/GetSearchResults.java @@ -8,40 +8,39 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.TssV2TransactionsPost201Response; public class GetSearchResults { - private static String responseCode = null; - private static String status = null; - private static String id = "95f6ab1c-d64d-4fdb-949d-cf174405c21f"; - private static Properties merchantProp; + private String id = "50b4d6fa-3f7c-46c1-986f-4a746b12661d"; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetSearchResults getSearchResults = new GetSearchResults(); + getSearchResults.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetSearchResults.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - SearchTransactionsApi searchTransactionsApi = new SearchTransactionsApi(); - TssV2TransactionsPost201Response response = searchTransactionsApi.getSearch(id); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + SearchTransactionsApi searchTransactionsApi = new SearchTransactionsApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + searchTransactionsApi.getSearch(id); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE:" + className + "\n"); } } diff --git a/src/main/java/samples/userManagement/coreServices/GetUserInformation.java b/src/main/java/samples/userManagement/coreServices/GetUserInformation.java index 9b2db83..c286007 100644 --- a/src/main/java/samples/userManagement/coreServices/GetUserInformation.java +++ b/src/main/java/samples/userManagement/coreServices/GetUserInformation.java @@ -8,39 +8,38 @@ import Data.Configuration; import Invokers.ApiClient; import Invokers.ApiException; -import Model.UmsV1UsersGet200Response; public class GetUserInformation { - private static String responseCode = null; - private static String status = null; - private static Properties merchantProp; + private Properties merchantProp; public static void main(String args[]) throws Exception { - process(); + GetUserInformation getUserInformation = new GetUserInformation(); + getUserInformation.process(); } - private static void process() throws Exception { - + private void process() throws Exception { + String className=GetUserInformation.class.getSimpleName(); + System.out.println("[BEGIN] EXECUTION OF SAMPLE CODE: "+className+"\n"); + ApiClient apiClient = null; try { - /* Read Merchant details. */ merchantProp = Configuration.getMerchantDetails(); MerchantConfig merchantConfig = new MerchantConfig(merchantProp); - ApiClient apiClient = new ApiClient(merchantConfig); - - UserManagementApi userManagementApi = new UserManagementApi(); - UmsV1UsersGet200Response response = userManagementApi.getUsers("testrest", null, null, "admin"); - - responseCode = ApiClient.responseCode; - status = ApiClient.status; - System.out.println("ResponseCode :" + responseCode); - System.out.println("ResponseMessage :" + status); - System.out.println("ResponseBody :"+ApiClient.respBody); - + UserManagementApi userManagementApi = new UserManagementApi(merchantConfig); + apiClient=Invokers.Configuration.getDefaultApiClient(); + userManagementApi.getUsers("testrest", null, null, "admin"); } catch (ApiException e) { - - e.printStackTrace(); + System.out.println("Exception on calling the Sample Code " +className+": "+apiClient.getRespBody()+"\n"); + } finally { + System.out.println("API REQUEST HEADERS:"); + System.out.println(apiClient.getRequestHeader() + "\n"); + System.out.println("API RESPONSE CODE: " + apiClient.getResponseCode() + "\n"); + System.out.println("API RESPONSE HEADERS:"); + System.out.println(apiClient.getResponseHeader() + "\n"); + System.out.println("API RESPONSE BODY:"); + System.out.println(apiClient.getRespBody() + "\n"); + System.out.println("[END] EXECUTION OF SAMPLE CODE: " + className + "\n"); } }