Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Authorize.Net Provider Error View modes: 
User avatar
Member
Member
envisasoftp-msn - 2/10/2010 11:24:50 AM
   
Authorize.Net Provider Error
After creating a custom donation web part (it's built off the e-commerce of Kentico), I am not able to successfully process the custom data in the provider; the following gateway error is returned:

Unable to finish payment: Payment data not found.

The donation web part has 3 main parts; name and address, products (used to allow users to select a donation to be made) and credit card information (this includes an option to add a separate billing address). The web part will create the customer, add addresses and the order fine. The problem is when the provider method for ProcessCustomData is called (then the ProcessPayment method is called next). The error is in the ShoppingCart.PaymentGatewayProvider.ErrorMessage.

There is no documentation as to what needs to be provided in the AuthorizeNetParameters for the custom data. Which leads to two questions:

1. Is there documentation as to what parameters need to be supplied (like Authorize.Net has a list used when posting in their samples)?

2. Has anybody else attempted to do this end to end without implementing the Kentico Shopping Cart UI?

Any help would be appreciated as to where I can get more information/sample code. I do not want to go buy a third party commerce control that I know works, when this should work fine.

Thanks much.

User avatar
Member
Member
envisasoftp-msn - 2/12/2010 8:25:17 PM
   
RE:Authorize.Net Provider Error
Update...

I have been able to move past the ProcessCustomData that I thought was causing the error. Now I am stuck at the ProcessPayment of the shopping carts PaymentGatewayProvider. After trying various things I am still stuck with the same error as mentioned before. I feel like there is no help out there for this kind of thing. I can hardly think that I am the first to attempt to create a single checkout page in Kentico, where a person could select a product, enter their name and address, then enter CC info and have it work. I have looked at both the AuthorizeNetForm.ascx and the ShoppingCartPaymentGateway.ascx, but they both use overridden methods for Next and Back which do not need to be implemented in the single page checkout process. And there is nothing different except for the PaymentDataForm stuff, which is where I think I am not getting adequate help. Am I required to create a custom PaymentDataForm that is similar to that of the AuthorizeNetForm?

Now here is even something more sad. I can create the manual POST to the Authorize.Net with the information collected and pass it to the gateway and get a response. So, at this point I am stuck doing this until I can get some help on why the ProcessPayment method is failing. And I cannot share this joyous web part with others until it works. I am sure there are plenty of people that would like a single page check out for their customers.

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 2/16/2010 3:01:50 AM
   
RE:Authorize.Net Provider Error
Hi,

ProcessCustomData of your Authorize.Net Provider will just gather the data from the PaymentDataForm (~\CMSModules\Ecommerce\Controls\PaymentGateways\AuthorizeNetForm.ascx.cs). I assume that you are not using any PaymentDataForm. So, for this purpose, you need to save your credit card information into PaymentGatewayCustomData:

this.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_NUMBER] = this.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_CCV] = this.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_EXPIRATION] =

You do not necessary to have PaymentDataForm in your scenario. However, you are getting the exception message („Unable to finish payment: Payment data not found.“) because ShoppingCartInfoObj.PaymentGatewayCustomData or ShoppingCartInfoObj are null.

Could you please post your code here?

Thank you.

Best regards,
Miroslav Remias.

User avatar
Member
Member
envisasoftp-msn - 2/16/2010 12:29:51 PM
   
RE:Authorize.Net Provider Error
Quick question then: what is "this"? When using a "this" reference, you need to state what that object is. Is it a ShoppingCartInfo object? Is it a ShoppingCart control? What you are supplying back is incredibly ambiguous to figure out. Here is how I am creating the shopping cart:

PaymentOptionInfo paymentOptionInfo = PaymentOptionInfoProvider.GetPaymentOptionInfo("AuthorizeNet", CMS.CMSHelper.CMSContext.CurrentSiteName);

ShoppingCart cart = new ShoppingCart();

cart.PaymentGatewayProvider = CMSAuthorizeNetProvider.GetPaymentGatewayProvider(paymentOptionInfo.PaymentOptionID);

cart.ShoppingCartInfoObj = ShoppingCartInfoProvider.CreateShoppingCartInfo(CMS.CMSHelper.CMSContext.CurrentSiteID);

cart.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_NUMBER] = creditcard1.CardNumber;
cart.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_CCV] = creditcard1.CCV;
cart.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_EXPIRATION] = new DateTime(creditcard1.ExpirationDate[1], creditcard1.ExpirationDate[0], DateTime.Now.Day);

cart.ShoppingCartInfoObj.ShoppingCartBillingAddressID = creditcard1.IsBillingAddress ? billingAddress.AddressID : donorAddress.AddressID;
cart.ShoppingCartInfoObj.ShoppingCartCustomerID = customer.CustomerID;
cart.ShoppingCartInfoObj.ShoppingCartPaymentOptionID = paymentOptionInfo.PaymentOptionID;
cart.ShoppingCartInfoObj.ShoppingCartSiteID = CMS.CMSHelper.CMSContext.CurrentSiteID;

As you can see I actually create an object, so "this" has no meaning to me in your context. I need to know if "this" = cart.ShoppingCartInfoObj or cart.PaymentGatewayProvider.ShoppingCartInfoObj. See what I mean? Two very different objects. Maybe you could clarify a bit more?

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 2/19/2010 4:47:59 AM
   
RE:Authorize.Net Provider Error
Hi,
I have just copied the example code from ~\CMSModules\Ecommerce\Controls\PaymentGateways\AuthorizeNetForm.ascx.cs file. "this" in my example refers to PaymentGatewayProvider.ShoppingCartInfoObj.

I hope that following example code will help you:

// create order, save the order section
// ... OrderInfo oi
// create order, save the order section

ShoppingCart cart = new ShoppingCart();
PaymentOptionInfo paymentOptionInfo = PaymentOptionInfoProvider.GetPaymentOptionInfo("AuthorizeNet", CMS.CMSHelper.CMSContext.CurrentSiteName);
cart.PaymentGatewayProvider = CMSAuthorizeNetProvider.GetPaymentGatewayProvider(paymentOptionInfo.PaymentOptionID);
cart.PaymentGatewayProvider.ShoppingCartInfoObj = ShoppingCartInfoProvider.CreateShoppingCartInfo(CMS.CMSHelper.CMSContext.CurrentSiteID);

CurrencyInfo ci = CurrencyInfoProvider.GetMainCurrency();

cart.PaymentGatewayProvider.ShoppingCartInfoObj.ShoppingCartPaymentOptionID = paymentOptionInfo.PaymentOptionID;
cart.PaymentGatewayProvider.ShoppingCartInfoObj.ShoppingCartCurrencyID = ci.CurrencyID;
cart.PaymentGatewayProvider.ShoppingCartInfoObj.ShoppingCartBillingAddressID = oi.OrderShippingAddressID;
cart.PaymentGatewayProvider.OrderId = oi.OrderId;

cart.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_NUMBER] = creditcard1.CardNumber;
cart.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_CCV] = creditcard1.CCV;
cart.ShoppingCartInfoObj.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_EXPIRATION] = new DateTime(creditcard1.ExpirationDate[1], creditcard1.ExpirationDate[0], DateTime.Now.Day);

if (cart.PaymentGatewayProvider.ShoppingCartInfoObj != null && cart.PaymentGatewayProvider.ShoppingCartInfoObj.PaymentGatewayCustomData != null)
{
cart.PaymentGatewayProvider.ProcessPayment();
}

Please note that this is just example code and you need to correct it according your scenario.

Best regards,
Miroslav Remias.

User avatar
Member
Member
envisasoftp-msn - 2/19/2010 1:58:49 PM
   
RE:Authorize.Net Provider Error
Great News!!! I got it to work!!! I am now in the clean up process and I am hoping to post the web part in the Marketplace for others to use. I am sure there are others that would like to build upon it and improve it.

Also, is there a place to post the code sample for others that may not want the web part but want to be able to accomplish something similar? I am not sure if posting the code in here is the proper place as it is fairly long.

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 3/2/2010 6:37:31 AM
   
RE:Authorize.Net Provider Error
Hi,

I’m glad that you have managed to solve your issues. If you would like to share the code with others you can post the code directly here.

Best regards,
Miroslav Remias