For what it is worth, I have implemented an Authorize.Net payment provider (charge, refund) based on the RC1 code base. Very easy to do, really. (I cannot post the code, so don't ask.)
That being said, I changed a few thing in my project, but here is my rough outline:
|
Implement the Store.Services.PaymentService.IPaymentProvider interface |
The provider must implement this interface, specifically the Authorize, Charge and Refund methods.
The interface should be re-factored to segregate the PayPal interface requirements from the base payment provider interface. (I did this, I didn't like the coupling - PayPal seems like a hack onto dashCommerce, rather than integrated. For me, express checkout is a service, as is direct for Standard and Pro.)
The class instance must have a constructor that matches (in order) the configuration properties stored. |
|
Add a control that creates and saves the configuration settings for the provider in the same order they are used for the class constructor. |
This is an implementation requirement for how the class instance is created (Activator.CreateInstance)
Settings I tracked: Service URL, Api Version, Api Logon, Api Transaction Key, Is Live/Test Mode, Email customer flag, Email merchant flag and merchant e-mail address. |
|
For configuration, store the transaction mode (live, test), API version, API login and transaction key. |
The configuration for the provider will need to store these values for payment processing (these are non-order specific.)
I also included e-mail and e-Check support as well as service URL information to switch between testing, live, and certification. |
|
Create the resource strings for the localization project for display. |
This keeps the solution consistent with the existing efforts for localization and provides configuration item help on the administration page. |
I abstracted the response handling a bit more than some implementations I have seen, all together though, it took me about 4-5 hours (having never implemented one before.)
Rough implementation:
Charge - use a NameValueCollection and build up the arguments. Pass them to the UploadValues method of the WebClient class, which returns a byte[ response. Parse that using the Encoding.Ascii.GetString. Split the string by "," and eliminate the field delimiters "|".
I created a helper method to rip out the response fields (AIM_GUIDE.PDF page #22), passing in an enumeration of the fields by position from the same guide.
If the response succeeds, use the Transaction code from the PayPayl provider, if it fails, write useful information into the Error string and do not create a transaction.
Hope that helps.
P.S. I also now have a UPS shipping provider and am working on FedEx and USPS.