1. Two phase payment
It looks like BroadleafCommerce's AuthorizeNetPaymentModule only support AuthorizeAndDebit single phase payment. The debit method (capture/settle fund) was not implemented. Based on authorize.net documentation at http://www.authorize.net/support/DirectPost_guide.pdf, two phase payment is supported by Direct Post. Is this due to resource constraint or technical limitation? Will two-phase be supported in the future?
2. Authorize.net Quick Start
I followed Authorize.net Quick Start steps at http://docs.broadleafcommerce.org/curre ... Start.html, implemented minimum a custom CheckoutController copied from the docs page as follows:
Code: Select all
@Controller
public class AuthorizeNetCheckoutController extends BroadleafAuthorizeNetController {
//This method will build the dynamic form necessary to POST directly to Authorize.net
@RequestMapping(value = "/checkout")
public String checkout(HttpServletRequest request, HttpServletResponse response, Model model,
@ModelAttribute("shippingInfoForm") ShippingInfoForm shippingForm,
@ModelAttribute("billingInfoForm") BillingInfoForm billingForm) {
return super.checkout(request, response, model);
}
//This is the URL that Authorize.net will call after receiving a Direct Post from a payment
//This should match ${authorizenet.relay.response.url} in your properties file.
@RequestMapping(value = "/process", method = RequestMethod.POST, produces = "text/html")
public @ResponseBody String processAuthorizeNetAuthorizeAndDebit(HttpServletRequest request,
HttpServletResponse response, Model model, @ModelAttribute("shippingInfoForm") ShippingInfoForm shippingForm,
@ModelAttribute("billingInfoForm") BillingInfoForm billingForm)
throws NoSuchAlgorithmException, UnsupportedEncodingException, PricingException, InvalidKeyException {
return super.processAuthorizeNetAuthorizeAndDebit(request, response, model);
}
}
I've also commented out the demo site's CheckoutController's /checkout method to avoid the ambiguity, but keep the other methods so cart's methods still work.
Code: Select all
@Controller
//@RequestMapping("/checkout")
public class CheckoutController extends BroadleafCheckoutController {
/*
* The Checkout page for Heat Clinic will have the shipping information pre-populated
* with an address if the fulfillment group has an address and fulfillment option
* associated with it. It also assumes that there is only one payment info of type
* credit card on the order. If so, then the billing address will be pre-populated.
*/
@RequestMapping("")
public String checkout(HttpServletRequest request, HttpServletResponse response, Model model,
@ModelAttribute("shippingInfoForm") ShippingInfoForm shippingForm,
@ModelAttribute("billingInfoForm") BillingInfoForm billingForm) {
prepopulateShippingAndBillingForms(CartState.getCart(), shippingForm, billingForm);
return super.checkout(request, response, model);
}
@RequestMapping(value="/singleship", method = RequestMethod.GET)
public String convertToSingleship(HttpServletRequest request, HttpServletResponse response, Model model) throws PricingException {
return super.convertToSingleship(request, response, model);
}
@RequestMapping(value="/singleship", method = RequestMethod.POST)
public String saveSingleShip(HttpServletRequest request, HttpServletResponse response, Model model,
@ModelAttribute("billingInfoForm") BillingInfoForm billingForm,
@ModelAttribute("shippingInfoForm") ShippingInfoForm shippingForm,
BindingResult result) throws PricingException, ServiceException {
return super.saveSingleShip(request, response, model, shippingForm, result);
}
...
...
...
A few problem:
1) The checkout form was disabled due to lack of shipping info.
As in demo code, it calls prepopulateShippingAndBillingForms that gives user opportunity to enter shipping info.
Code: Select all
prepopulateShippingAndBillingForms(CartState.getCart(), shippingForm, billingForm);
return super.checkout(request, response, model);
The new controller doesn't have such method that causes "no shipping info" and the entire form was disabled. How is this supposed to work? I thought we would let user enter shipping info later down the line.
2) The payment page has a variable, authorizenet_server_url, that the super class is supposed to retrieve it from the merged properties, but it's blank.
I've configured all the properties files in demo/site project including common, local, development, staging, production.
common.properties:
Code: Select all
authorizenet.merchant.transaction.version=3.1
local.properties looks:
Code: Select all
authorizenet.api.login.id=Test Account API Key
authorizenet.transaction.key=Test Account Transaction Key
authorizenet.merchant.md5.key=md5 hash I entered
authorizenet.relay.response.url=http://localhost:8080/commerce/authorizenet/process
authorizenet.confirm.url=http://localhost:8080/commerce/confirmation
authorizenet.error.url=http://localhost:8080/commerce/authorizenet/error
authorizenet.server.url=https://test.authorize.net/gateway/transact.dll
authorizenet.x_test_request=FALSE
I know this won't work as localhost won't be publicly accessible, but the part within demo site and Broadleaf should work. Somehow it doesn't pick up the configuration.
Do I miss something? Please help!
Thank you!
-Charlie