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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to