Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added shipping address form to sample_project AIM payment example

  • Loading branch information...
commit 1d984555c96595342f0a20d9755cc9da186e0d7b 1 parent 5549908
@zen4ever authored
View
11 sample_project/samplestore/views.py
@@ -10,7 +10,7 @@
from django.contrib.auth.decorators import login_required
from authorizenet import AUTHNET_POST_URL, AUTHNET_TEST_POST_URL
-from authorizenet.forms import SIMPaymentForm, SIMBillingForm
+from authorizenet.forms import SIMPaymentForm, SIMBillingForm, ShippingAddressForm
from authorizenet.models import Response
from authorizenet.views import AIMPayment
from authorizenet.utils import get_fingerprint, capture_transaction
@@ -129,9 +129,12 @@ def make_direct_payment(request, invoice_id, auth_only=False):
extra_data['amount'] = "%.2f" % invoice.item.price
extra_data['invoice_num'] = invoice.id
extra_data['description'] = invoice.item.title
- pp = AIMPayment(extra_data=extra_data,
- context={'item': invoice.item},
- initial_data=initial_data)
+ pp = AIMPayment(
+ extra_data=extra_data,
+ context={'item': invoice.item},
+ initial_data=initial_data,
+ shipping_form_class=ShippingAddressForm
+ )
return pp(request)
View
4 sample_project/templates/authorizenet/aim_payment.html
@@ -5,7 +5,11 @@
{{ item.price }}</p>
<p>{{ errors }}</p>
<form action="." method="POST">{% csrf_token %}
+<h2>Billing address</h2>
{{ billing_form.as_p }}
+<h2>Shipping address</h2>
+{{ shipping_form.as_p }}
+<h2>Payment info</h2>
{{ payment_form.as_p }}
<input type="submit" value="Pay" />
</form>
Please sign in to comment.
Something went wrong with that request. Please try again.