Page 1 of 7

Wire payment module or offline transaction module

Posted: Thu Aug 01, 2013 2:28 am
by ankitpatni
Hi,

Is there anyway to use wire payment module or offline payment transaction module in broadleaf commerce 2.2.0.

Currently I'm using Paypal payment method as its described in documentation but now I want to remove credit card payment module (which is by default integrate in core). In place of this credit card module i want to use offline payment module or wire transfer module.

In offline payment module or wire transfer payment module i would like to save users cart and send him on conformation page. Also I would like to send him a mail of his cart but it will more like a just cart info email with my wire transfer details. Once i'll get the wire transfer success I'll send the same conformation email to user with all the details which is mention in email conformation template under core.

I'm not sure what will be workflow i need to alter or write to create wire transfer or offline payment module in broadleaf commerce 2.2.0.

Any guides or help will be highly appreciated here.

Thanks & Regards,
Ankit Patni

Re: Wire payment module or offline transaction module

Posted: Thu Aug 01, 2013 10:22 am
by hiteshsingla
Thumbs up for this post!!
Now-a-Days this is a must to have feature in any ecommerce plattform.I think this should be incorporated in the core itself.
Even i would appreciate if anyone finds how to incorporate this in Broadleaf Commerce.

Re: Wire payment module or offline transaction module

Posted: Thu Aug 01, 2013 10:24 am
by Anky
I am also looking for the same workflow.
Actually I want to enable the cash on delivery .
so,can you please guide me how can I append this in the current workflow.


Regards,
Ankit Aggarwal

Re: Wire payment module or offline transaction module

Posted: Thu Aug 01, 2013 10:30 am
by ankitpatni
Wow so i'm not the one who need this :D . When first my boss i asked this i feel sound stupid idea :mrgreen: :mrgreen: but now when i read some blogs on this i feel its really a nice idea to have this feature.

Nice to know that you guys need the same thing to do this. I try to handle it in different way with jQuery but i guess without changing the main workflow it is not possible / good approach to do this. I badly need some clue on this to crack it out. I feel i'm so close to this and all of sudden i got stuck here with wire payment option?

Admin please help us of guide us.

Thanks & Regards,
Ankit Patni

Re: Wire payment module or offline transaction module

Posted: Thu Aug 01, 2013 10:46 am
by elbertbautista
In Broadleaf 2.3 and above there is a module that may be beneficial to you if you need to handle offline transactions.
See: org.broadleafcommerce.core.payment.service.module.AcceptAndPassthroughModule

https://github.com/BroadleafCommerce/Br ... odule.java

Re: Wire payment module or offline transaction module

Posted: Thu Aug 01, 2013 11:26 am
by ankitpatni
Hi elbertbautista,

You are the life saver :) :) :) .

Now let me try to migrate my project to 2.2.0 to 2.3.0 and test this. If this work then seriously you have saved my life.

Thank you so much i really appreciate your help from bottom of my heart :).

Thanks & Regards,
Ankit Patni

Re: Wire payment module or offline transaction module

Posted: Fri Aug 02, 2013 4:44 am
by hiteshsingla
Thanks elbert!!
I looked at this file and found it useful.
I have only one doubt that with what type PaymentActionType I need to associate this payment service??
Will it be AuthorizeAndDebit or VoidPayment??
And do i need to write any more custom code for this process to go to succes??
Glad if you can suggest me something

Thanks & Regards
Hitesh Singla

Re: Wire payment module or offline transaction module

Posted: Mon Aug 05, 2013 12:30 pm
by elbertbautista
@hiteshsingia - Only the Authorize and Debit method is implemented in this module so the PaymentActionType should be AuthorizeAndDebit

Line 65:
@Override
public PaymentResponseItem processAuthorizeAndDebit(PaymentContext paymentContext, Money amountToDebit, PaymentResponseItem responseItem) throws PaymentException {
responseItem.setTransactionSuccess(true);
responseItem.setTransactionAmount(amountToDebit);
return responseItem;
}

Re: Wire payment module or offline transaction module

Posted: Tue Aug 06, 2013 9:11 am
by hiteshsingla
HI Elbert!!
Yeah i got this and thanks a lot for your reply.
But i am still confused about what changes i need to make in my CheckoutController in order to get the order confirmation using AcceptAndPassThrough module?
As suggested in the file, I have done the following changes in my ApplicationContext.xml:

Code: Select all

<bean id="blWirePaymentModule" class="org.broadleafcommerce.core.payment.service.module.AcceptAndPassthroughModule">
   <property name="validPaymentInfoType" value="WIRE"/>
</bean>
<bean id="blWirePaymentService" class="org.broadleafcommerce.core.payment.service.PaymentServiceImpl">
        <property name="paymentModule" ref="blWirePaymentModule"/>
</bean>

<bean id="blPaymentWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
        <property name="processContextFactory">
            <bean class="org.broadleafcommerce.core.payment.service.workflow.SimplePaymentProcessContextFactory"/>
        </property>
        <property name="activities">
            <list>
                <bean class="org.broadleafcommerce.core.payment.service.workflow.CompositeActivity">
                    <property name="workflow" ref="blAuthorizeAndDebitWorkflow"/>
                </bean>
            </list>
        </property>
        <property name="defaultErrorHandler" ref="blDefaultErrorHandler"/>
</bean>
<bean id="blAuthorizeAndDebitWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
      <property name="processContextFactory">
         <bean class="org.broadleafcommerce.core.payment.service.workflow.PaymentProcessContextFactory">
            <property name="paymentActionType" value="AUTHORIZEANDDEBIT"/>
         </bean>
      </property>
      <property name="activities">
         <list>
         <bean class="org.broadleafcommerce.core.payment.service.workflow.PaymentActivity">
            <property name="paymentService" ref="blWirePaymentService"/>
         </bean>
      </list>
      </property>
      <property name="defaultErrorHandler" ref="blDefaultErrorHandler"/>
   </bean>


I am bit confused about the method used in controller called completeSecureCreditCardCheckout().
Which method should i use to get the order to success using wire payment?

Thanks & Regards
Hitesh Singla

Re: Wire payment module or offline transaction module

Posted: Tue Aug 06, 2013 1:31 pm
by elbertbautista
The default BroadleafCheckoutController assumes a standard authorize and debit via a credit card.

If you would like to complete a checkout using a Wire Payment, you will need to extend the BroadleafCheckoutController and override the completeCheckout() method and execute the checkout service directly and not have to deal with any sort of credit card information. You can execute the checkout service and checkout workflow by calling:

Code: Select all

CheckoutResponse checkoutResponse = checkoutService.performCheckout(cart, payments);


You should familiarize yourself with the Checkout and Payment workflows to see how each of these work:
http://docs.broadleafcommerce.org/core/ ... t-workflow
http://docs.broadleafcommerce.org/core/ ... s/checkout