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.
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; }
08-28-2017 01:33 PM