My name is Joy. I am working on creating POC of credit card payment through killbill using Authorise.Net payment gateway. I am creating KillBill Plugin in Java for Authorise.Net. I have written a partial code for now, I am just initiating the purchase transaction which hit the purchasePayment() function of plugin. From this function I am calling the other method which sends information to payment gateway and print the response from the
gateway. If I run this method locally then then I get successful transaction response but if its get called from plugin (purchasePayment() function) then the response is coming null from the gateway. Here is the code snippet:
public PaymentTransactionInfoPlugin purchasePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException
{
System.out.println("In plugin method purchasePayment");
CreateTransactionResponse response = (CreateTransactionResponse) run("2H9vBCYb84n", "79ad58W32WBmZV9A", 20.00);
DateTime effectiveDate = null;
DateTime createdDate = null;
PaymentPluginStatus status = null;
String gatewayErrorCode = null;
String gatewayError = null;
return new PaymentTransactionInfo(kbPaymentMethodId, kbTransactionId, TransactionType.PURCHASE, amount, currency, effectiveDate, createdDate, status, gatewayErrorCode, gatewayError);
}
public static void main(String[] ags)
{
CreateTransactionResponse response = (CreateTransactionResponse) run("2H9vBCYb84n", "79ad58W32WBmZV9A", 20.00);
}
public static ANetApiResponse run(String apiLoginId, String transactionKey, Double amount)
{
System.out.println("In run method of authorise.net with transactionKey: " + transactionKey + " and APILoginId: " + apiLoginId);
System.out.println("Current Thread Name: " + Thread.currentThread().getName());
//Common code to set for all requests
ApiOperationBase.setEnvironment(Environment.SANDBOX);
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
// Populate the payment data
PaymentType paymentType = new PaymentType();
CreditCardType creditCard = new CreditCardType();
creditCard.setCardNumber("5424000000000015");
creditCard.setExpirationDate("1220");
creditCard.setCardCode("999");
paymentType.setCreditCard(creditCard);
// Create the payment transaction request
TransactionRequestType txnRequest = new TransactionRequestType(); txnRequest.setRefTransId("101");
txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
txnRequest.setPayment(paymentType);
txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
// Make the API Request
CreateTransactionRequest apiRequest = new CreateTransactionRequest();
apiRequest.setTransactionRequest(txnRequest);
CreateTransactionController controller = new CreateTransactionController(apiRequest);
controller.execute();
if(controller.getResultCode() == null)
System.out.println("Controller.getResultCode is NULL");
else
System.out.println("Result code: " + controller.getResultCode().value());
CreateTransactionResponse response = controller.getApiResponse();
if (response!=null) {
// If API Response is ok, go ahead and check the transaction response
if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
TransactionResponse result = response.getTransactionResponse();
if(result.getMessages() != null){
System.out.println("Successfully created transaction with Transaction ID: " + result.getTransId());
System.out.println("Response Code: " + result.getResponseCode());
System.out.println("Message Code: " + result.getMessages().getMessage().get(0).getCode());
System.out.println("Description: " + result.getMessages().getMessage().get(0).getDescription());
System.out.println("Auth Code: " + result.getAuthCode());
}
else {
System.out.println("Failed Transaction.");
if(response.getTransactionResponse().getErrors() != null){
System.out.println("Error Code: " + response.getTransactionResponse().getErrors().getError().get(0).getErrorCode());
System.out.println("Error message: " + response.getTransactionResponse().getErrors().getError().get(0).getErrorText());
}
}
}
else {
System.out.println("Failed Transaction.");
if(response.getTransactionResponse() != null && response.getTransactionResponse().getErrors() != null){
System.out.println("Error Code: " + response.getTransactionResponse().getErrors().getError().get(0).getErrorCode());
System.out.println("Error message: " + response.getTransactionResponse().getErrors().getError().get(0).getErrorText());
}
else {
System.out.println("Error Code: " + response.getMessages().getMessage().get(0).getCode());
System.out.println("Error message: " + response.getMessages().getMessage().get(0).getText());
}
}
}
else {
System.out.println("Null Response from authorise.net.");
}
return response;
}
In above code the run method is interacting with Authorise.Net and getting the response. When I hit this function from main(), the transaction goes successful but when it comes through killbillplugin (from purchasePayment() -> run()) the response (controller.getApiResponse()) is coming null. I am not able to figure out what I am missing. Kindly, help me out with this. Thanks!
I am working on creating POC of credit card payment through killbill using Authorise.Net payment gateway. I am creating KillBill Plugin in Java for Authorise.Net.
If I run this method locally then then I get successful transaction response but if its get called from plugin (purchasePayment() function) then the response is coming null from the gateway.
I have checked that the plugin is running. I have just wrote some initial code to create a POC. I will upload it to github as soon as I complete my research on this and get some more functions working.
For the mentioned issue, this is what I got in log:
09/21/16 07:38:48,976: DEBUG [Plugin-th-48] (net.authorize.api.controller.base.ApiOperationBase:140) - Executing Request:'net.authorize.api.contract.v1.CreateTransactionRequest@3eeba6c2'
09/21/16 07:38:48,982: DEBUG [pool-6-thread-1] (net.authorize.util.HttpUtility:71) - MerchantInfo->LoginId/TransactionKey: '2H9vBCYb84n':'79ad58W32WBmZV9A'
09/21/16 07:38:48,984: DEBUG [pool-6-thread-1] (net.authorize.util.HttpUtility:72) - Posting request to Url: 'https://apitest.authorize.net/xml/v1/request.api'
09/21/16 07:38:49,267: DEBUG [pool-6-thread-1] (net.authorize.util.HttpUtility:84) - Request: '
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>2H9vBCYb84n</name>
<transactionKey>79ad58W32WBmZV9A</transactionKey>
</merchantAuthentication>
<clientId>sdk-java-1.9.0</clientId>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>20.00</amount>
<payment>
<creditCard>
<cardNumber>5424000000000015</cardNumber>
<expirationDate>1220</expirationDate>
<cardCode>999</cardCode>
</creditCard>
</payment>
<refTransId>101</refTransId>
</transactionRequest>
</createTransactionRequest>
'
09/21/16 07:38:49,274: INFO [pool-6-thread-1] (net.authorize.util.LogHelper:24) - Use Proxy: 'false'
09/21/16 07:38:49,314: DEBUG [pool-6-thread-1] (org.apache.http.impl.conn.SingleClientConnManager:195) - Get connection for route HttpRoute[{s}->https://apitest.authorize.net]
09/21/16 07:38:49,698: ERROR [Plugin-th-48] (net.authorize.util.HttpUtility:111) - Execution error for http post Message: 'java.lang.NoClassDefFoundError: javax/security/auth/x500/X500Principal'
09/21/16 07:38:49,699: DEBUG [Plugin-th-48] (net.authorize.api.controller.base.ApiOperationBase:165) - Got a 'null' Response for request:'net.authorize.api.contract.v1.CreateTransactionRequest@3eeba6c2'
Controller.getResultCode is NULL
We've been working on a java Auth.Net plugin for the last ~6 months, and we're currently using it in production.
We're using Auth.Net's CIM mechanism for storing customer payment profile information to minimize our PCI footprint.
We plan to open source our plugin shortly, possibly as early as next week.
--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-users+unsubscribe@googlegroups.com.
To post to this group, send email to killbilling-users@googlegroups.com.
Visit this group at https://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/334844ef-9d50-4950-bc49-b95e012b18d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I am very thankful to both of you for your time and reply. I am eagerly waiting for this plugin to be public. It will save my lots of research time.
Thaks