Re: [mezzanine-users] External payment processing Cartridge

2016-10-26 Thread Joseph Mohan
Have you seen this: https://github.com/explodes/cartridge-payments ?

I've been using it recently as a reference. It uses a callback_uuid to 
uniquely identify orders before POSTing to paypal etc..

If you have the time, install it on a fresh cartridge and see how it works, 
some really handy stuff in there. Pay most attention to line 33 
of 
https://github.com/explodes/cartridge-payments/blob/master/payments/multipayments/forms/paypal.py

Good luck!

On Monday, 30 May 2016 21:49:41 UTC+1, Reino Wallin wrote:
>
> Thank you for helping out Eduardo.
>
> Since I enabled the confirmation step I modified the confirmation.html 
> template with the action attribute, and the page at DIBS loads properly.
>
> However I can't figure out how to access the Django order model instance 
> in my customized OrderForm. The order model instance is supposed to be 
> passed to the checkout in the final step.  
>
> I suppose the final step can be checked with:
>
> is_last_step = step == checkout.CHECKOUT_STEP_LAST
>
> I need the values of the 'total' and 'id' attributes in the order model 
> instance, to be added to the form that is posted to DIBS.
>
> In my customized OrderForm I tried 
>
> if is_last_step:
> self.save(commit=False)
> order = self.instance
> self.fields['orderid'].initial = order.id
>
> Why doesn't it work? What is the best approach to access the order model 
> instance in the last step in the order form?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] External payment processing Cartridge

2016-10-18 Thread Matthew Moon
Hi Reino

I'm in the process of creating an external payment app for the South 
African payment platform called "Payfast", and I'm having the exact same 
problem.
I can post almost all the data to the service provider correctly, except I 
can't seem to find the "amount" or "total" and the order.id (which I 
understand, the order is only created in the table after the payment is 
completed) and the description of the items in the cart.

How did you get around this?
Also after the payment is completed, I need to verify the payment details 
for security and match it to the correct data, and not a man-in-the-middle 
attack.

On Monday, May 30, 2016 at 10:49:41 PM UTC+2, Reino Wallin wrote:
>
> Thank you for helping out Eduardo.
>
> Since I enabled the confirmation step I modified the confirmation.html 
> template with the action attribute, and the page at DIBS loads properly.
>
> However I can't figure out how to access the Django order model instance 
> in my customized OrderForm. The order model instance is supposed to be 
> passed to the checkout in the final step.  
>
> I suppose the final step can be checked with:
>
> is_last_step = step == checkout.CHECKOUT_STEP_LAST
>
> I need the values of the 'total' and 'id' attributes in the order model 
> instance, to be added to the form that is posted to DIBS.
>
> In my customized OrderForm I tried 
>
> if is_last_step:
> self.save(commit=False)
> order = self.instance
> self.fields['orderid'].initial = order.id
>
> Why doesn't it work? What is the best approach to access the order model 
> instance in the last step in the order form?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] External payment processing Cartridge

2016-05-30 Thread Reino Wallin
Thank you for helping out Eduardo.

Since I enabled the confirmation step I modified the confirmation.html 
template with the action attribute, and the page at DIBS loads properly.

However I can't figure out how to access the Django order model instance in 
my customized OrderForm. The order model instance is supposed to be passed 
to the checkout in the final step.  

I suppose the final step can be checked with:

is_last_step = step == checkout.CHECKOUT_STEP_LAST

I need the values of the 'total' and 'id' attributes in the order model 
instance, to be added to the form that is posted to DIBS.

In my customized OrderForm I tried 

if is_last_step:
self.save(commit=False)
order = self.instance
self.fields['orderid'].initial = order.id

Why doesn't it work? What is the best approach to access the order model 
instance in the last step in the order form?

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] External payment processing Cartridge

2016-05-26 Thread Eduardo Rivas
The action attribute is on the form's markup, not in the Python form.



The view serving the return url should be the one completing the order.

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] External payment processing Cartridge

2016-05-25 Thread Reino Wallin
Thank you for your reply Eduardo,

To make sure I understand you correct my DibsPaymentOrderForm is posted 
below. However, I have a few problems to solve. The webpage at DIBS is not 
loaded in the checkout process. After the checkout form is filled with data 
and submitted, the "Order Complete" page is loaded, regardless of 
SHOP_CHECKOUT_STEPS_CONFIRMATION and SHOP_PAYMENT_STEP_ENABLED, is set to 
True or False. It seems I am doing something wrong. I tried to set the 
action attribute with theese lines:

@property
def action(self):
   return 'https://payment.architrade.com/paymentweb/start.action'

Furthermore, what is the best approach to access the order object in 
DibsPaymentOrderForm? order.id and and order.total is required when posting 
the form to DIBS.

This is what I have done so far:

from __future__ import unicode_literals
from future.builtins import int
from future.builtins import str
from django import forms
from mezzanine.conf import settings
from cartridge.shop import checkout
from cartridge.shop.models import Cart, Order
from cartridge.shop.forms import OrderForm

class DibsPaymentOrderForm(OrderForm):
"""
Main Form for the checkout process - ModelForm for the Order Model
without fields for credit card. Used across each step of the
checkout process with fields being hidden where applicable.
"""

#class Meta(OrderForm.Meta):
#exclude = ('billing_detail_state', 'card_name', \
#'card_type', 'card_number', \
#'card_expiry_month', 'card_ccv', 'card_expiry_year',)

merchant = forms.IntegerField(\
required = True, \
widget=forms.HiddenInput)

orderid = forms.IntegerField(\
required = False, \
widget=forms.HiddenInput)

paytype = forms.CharField(\
required = True, \
localize = True, \
widget=forms.HiddenInput)

test = forms.IntegerField(\
required = True, \
min_value = 0, \
widget=forms.HiddenInput)

accept_url = forms.CharField(\
required = True, \
localize = True, \
widget=forms.HiddenInput)

callback_url = forms.CharField(\
required = True, \
localize = True, \
widget=forms.HiddenInput)

cancel_url = forms.CharField(\
required = True, \
localize = True, \
widget=forms.HiddenInput)

ipaddress = forms.GenericIPAddressField(\
required = True, \
widget=forms.HiddenInput)

def __init__(self, request, *args, **kwargs):
super(DibsPaymentOrderForm, self).__init__(request, *args, **kwargs)
for field in ('billing_detail_state', 'card_name', \
'card_type', 'card_number', \
'card_expiry_month', 'card_ccv', 'card_expiry_year'):
del self.fields[field]
self.fields['merchant'].initial = int(settings.DIBS_MERCHANT_ID)
self.fields['paytype'].initial = settings.DIBS_PAYTYPE
self.fields['test'].initial = 1
self.fields['accept_url'].initial = settings.DIBS_ACCEPT_URL
self.fields['callback_url'].initial = settings.DIBS_CALLBACK_URL
self.fields['cancel_url'].initial = settings.DIBS_CANCEL_URL
try:
self.fields['ipaddress'].initial = 
request.META['HTTP_X_FORWARDED_FOR']
except:
self.fields['ipaddress'].initial = request.META['REMOTE_ADDR']


@property
def action(self):
   return 'https://payment.architrade.com/paymentweb/start.action'

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] External payment processing Cartridge

2016-05-23 Thread Eduardo Rivas
I remember doing something similar. My general approach is to set the 
form's "action" attribute to the external site, so the actual POST 
request is handled by them. This request usually has just the amount and 
maybe a charge description and ID. Then the user is taken to their site, 
and inputs all the credit card data. The payment processor should let 
you define a "return" url, and the user should come back to your site 
via that. You have to create a view that will handle GET or POST params 
to complete the Order instance in Cartridge. After that you can redirect 
to the Order receipt or the Order history.


--
You received this message because you are subscribed to the Google Groups "Mezzanine 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.