<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Null Response on all API Calls using Java SDK in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Null-Response-on-all-API-Calls-using-Java-SDK/m-p/59566#M34148</link>
    <description>&lt;P&gt;My sandbox creditials were working fine until a couple of days ago. Now, regardless of call I'm attempting the API returns a null response. Attached is some sample code that was modified from the code samples. API_LOGIN and API_KEY are defined with my sandbox info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public HashMap runCardSample(){
        
        HashMap retValue = new HashMap();
        retValue.put("success", false);
        
        
        //Common code to set for all requests
        ApiOperationBase.setEnvironment(Environment.SANDBOX);

        MerchantAuthenticationType merchantAuthenticationType  = new MerchantAuthenticationType() ;
        merchantAuthenticationType.setName(API_LOGIN);
        merchantAuthenticationType.setTransactionKey(API_KEY);
        ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

        // Populate the payment data
        PaymentType paymentType = new PaymentType();
        CreditCardType creditCard = new CreditCardType();
        creditCard.setCardNumber("4242424242424242");
        creditCard.setExpirationDate("0822");
        paymentType.setCreditCard(creditCard);

        // Create the payment transaction request
        TransactionRequestType txnRequest = new TransactionRequestType();
        txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
        txnRequest.setPayment(paymentType);
        txnRequest.setAmount(new BigDecimal(500.00));
        
        // Make the API Request
        CreateTransactionRequest apiRequest = new CreateTransactionRequest();
        apiRequest.setTransactionRequest(txnRequest);
        CreateTransactionController controller = new CreateTransactionController(apiRequest);
        controller.execute();


        CreateTransactionResponse response = controller.getApiResponse();

        if (response!=null) {
            retValue.put("responseIsNull", false);
            retValue.put("resultCode", response.getMessages().getResultCode());
            // If API Response is ok, go ahead and check the transaction response
            if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
                retValue.put("success", true);
                TransactionResponse result = response.getTransactionResponse();
                if (result.getResponseCode().equals("1")) {
                    retValue.put("responseCode", result.getResponseCode());
                    retValue.put("message", "Successful Credit Card Transaction");
                    retValue.put("authCode", result.getAuthCode());
                    retValue.put("transId", result.getTransId());
                } else {
                    retValue.put("message", "Failed Transaction");
                    retValue.put("responseCode", result.getResponseCode());
                }
            } else {
                retValue.put("message", "Failed Transaction");
                retValue.put("responseCode", response.getMessages().getResultCode());
            }
        } else {
            retValue.put("responseIsNull", true);
        }
        
        return retValue;
    }&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Aug 2017 20:33:22 GMT</pubDate>
    <dc:creator>ClintParsley</dc:creator>
    <dc:date>2017-08-28T20:33:22Z</dc:date>
    <item>
      <title>Null Response on all API Calls using Java SDK</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Null-Response-on-all-API-Calls-using-Java-SDK/m-p/59566#M34148</link>
      <description>&lt;P&gt;My sandbox creditials were working fine until a couple of days ago. Now, regardless of call I'm attempting the API returns a null response. Attached is some sample code that was modified from the code samples. API_LOGIN and API_KEY are defined with my sandbox info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public HashMap runCardSample(){
        
        HashMap retValue = new HashMap();
        retValue.put("success", false);
        
        
        //Common code to set for all requests
        ApiOperationBase.setEnvironment(Environment.SANDBOX);

        MerchantAuthenticationType merchantAuthenticationType  = new MerchantAuthenticationType() ;
        merchantAuthenticationType.setName(API_LOGIN);
        merchantAuthenticationType.setTransactionKey(API_KEY);
        ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

        // Populate the payment data
        PaymentType paymentType = new PaymentType();
        CreditCardType creditCard = new CreditCardType();
        creditCard.setCardNumber("4242424242424242");
        creditCard.setExpirationDate("0822");
        paymentType.setCreditCard(creditCard);

        // Create the payment transaction request
        TransactionRequestType txnRequest = new TransactionRequestType();
        txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
        txnRequest.setPayment(paymentType);
        txnRequest.setAmount(new BigDecimal(500.00));
        
        // Make the API Request
        CreateTransactionRequest apiRequest = new CreateTransactionRequest();
        apiRequest.setTransactionRequest(txnRequest);
        CreateTransactionController controller = new CreateTransactionController(apiRequest);
        controller.execute();


        CreateTransactionResponse response = controller.getApiResponse();

        if (response!=null) {
            retValue.put("responseIsNull", false);
            retValue.put("resultCode", response.getMessages().getResultCode());
            // If API Response is ok, go ahead and check the transaction response
            if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
                retValue.put("success", true);
                TransactionResponse result = response.getTransactionResponse();
                if (result.getResponseCode().equals("1")) {
                    retValue.put("responseCode", result.getResponseCode());
                    retValue.put("message", "Successful Credit Card Transaction");
                    retValue.put("authCode", result.getAuthCode());
                    retValue.put("transId", result.getTransId());
                } else {
                    retValue.put("message", "Failed Transaction");
                    retValue.put("responseCode", result.getResponseCode());
                }
            } else {
                retValue.put("message", "Failed Transaction");
                retValue.put("responseCode", response.getMessages().getResultCode());
            }
        } else {
            retValue.put("responseIsNull", true);
        }
        
        return retValue;
    }&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Aug 2017 20:33:22 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Null-Response-on-all-API-Calls-using-Java-SDK/m-p/59566#M34148</guid>
      <dc:creator>ClintParsley</dc:creator>
      <dc:date>2017-08-28T20:33:22Z</dc:date>
    </item>
  </channel>
</rss>

