Example #1
0
def beanstream(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("beanstream")
            response = merchant.purchase(amount, credit_card,
                                         {"billing_address": {
                        "name": "%s %s" % (data["first_name"], data["last_name"]),
                        # below are hardcoded just for the sake of the example
                        # you can make these optional by toggling the customer name
                        # and address in the account dashboard.
                        "email": "*****@*****.**",
                        "phone": "555-555-555-555",
                        "address1": "Addr1",
                        "address2": "Addr2",
                        "city": "Hyd",
                        "state": "AP",
                        "country": "IN"
                        }
                                          })
    else:
        form = CreditCardForm(initial={'number':'4030000010001234',
                                       'card_type': 'visa',
                                       'verification_value': 123})
    return render(request, 'app/index.html',{'form': form,
                                             'amount': amount,
                                             'response': response,
                                             'title': 'Beanstream'})
Example #2
0
def paylane(request):
    amount = 1
    response= None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("paylane")
            customer = PaylanePaymentCustomer()
            customer.name = "%s %s" %(data['first_name'], data['last_name'])
            customer.email = "*****@*****.**"
            customer.ip_address = "127.0.0.1"
            options = {}
            address = PaylanePaymentCustomerAddress()
            address.street_house = 'Av. 24 de Julho, 1117'
            address.city = 'Lisbon'
            address.zip_code = '1700-000'
            address.country_code = 'PT'
            customer.address = address
            options['customer'] = customer
            options['product'] = {}
            response = merchant.purchase(amount, credit_card, options = options)
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['paylane'])
    return render(request, 'app/index.html', {'form': form,
                                              'amount':amount,
                                              'response':response,
                                              'title':'Paylane Gateway'})
Example #3
0
def beanstream(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("beanstream")
            response = merchant.purchase(amount, credit_card,
                                         {"billing_address": {
                        "name": "%s %s" % (data["first_name"], data["last_name"]),
                        # below are hardcoded just for the sake of the example
                        # you can make these optional by toggling the customer name
                        # and address in the account dashboard.
                        "email": "*****@*****.**",
                        "phone": "555-555-555-555",
                        "address1": "Addr1",
                        "address2": "Addr2",
                        "city": "Hyd",
                        "state": "AP",
                        "country": "IN"
                        }
                                          })
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['beanstream'])
    return render(request, 'app/index.html',{'form': form,
                                             'amount': amount,
                                             'response': response,
                                             'title': 'Beanstream'})
Example #4
0
def paylane(request):
    amount = 1
    response= None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("paylane")
            customer = PaylanePaymentCustomer()
            customer.name = "%s %s" %(data['first_name'], data['last_name'])
            customer.email = "*****@*****.**"
            customer.ip_address = "127.0.0.1"
            options = {}
            address = PaylanePaymentCustomerAddress()
            address.street_house = 'Av. 24 de Julho, 1117'
            address.city = 'Lisbon'
            address.zip_code = '1700-000'
            address.country_code = 'PT'
            customer.address = address
            options['customer'] = customer
            options['product'] = {}
            response = merchant.purchase(amount, credit_card, options = options)
    else:
        form = CreditCardForm(initial={'number':'4111111111111111'})
    return render(request, 'app/index.html', {'form': form,
                                              'amount':amount,
                                              'response':response,
                                              'title':'Paylane Gateway'})
Example #5
0
def paypal(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("pay_pal")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            # response = merchant.purchase(amount, credit_card, options={'request': request})
            response = merchant.recurring(amount,
                                          credit_card,
                                          options={'request': request})
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['paypal'])
    return render(request, 'app/index.html', {
        'form': form,
        'amount': amount,
        'response': response,
        'title': 'Paypal'
    })
Example #6
0
def paypal(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("pay_pal")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            # response = merchant.purchase(amount, credit_card, options={'request': request})
            response = merchant.recurring(amount,
                                          credit_card,
                                          options={'request': request})
    else:
        form = CreditCardForm(
            initial={
                'number': '4797503429879309',
                'verification_value': '037',
                'month': 1,
                'year': 2019,
                'card_type': 'visa'
            })
    return render(request, 'app/index.html', {
        'form': form,
        'amount': amount,
        'response': response,
        'title': 'Paypal'
    })
Example #7
0
def paypal(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("pay_pal")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            # response = merchant.purchase(amount, credit_card, options={'request': request})
            response = merchant.recurring(amount, credit_card, options={'request': request})
    else:
        form = CreditCardForm(initial={'number': '4797503429879309',
                                       'verification_value': '037',
                                       'month': 1,
                                       'year': 2019,
                                       'card_type': 'visa'})
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Paypal'})
Example #8
0
def eway(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("eway")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            billing_address = {
                'salutation': 'Mr.',
                'address1': 'test',
                'address2': ' street',
                'city': 'Sydney',
                'state': 'NSW',
                'company': 'Test Company',
                'zip': '2000',
                'country': 'au',
                'email': '*****@*****.**',
                'fax': '0267720000',
                'phone': '0267720000',
                'mobile': '0404085992',
                'customer_ref': 'REF100',
                'job_desc': 'test',
                'comments': 'any',
                'url': 'http://www.google.com.au',
            }
            response = merchant.purchase(amount,
                                         credit_card,
                                         options={
                                             'request': request,
                                             'billing_address': billing_address
                                         })
    else:
        form = CreditCardForm(
            initial={
                'number': '4444333322221111',
                'verification_value': '000',
                'month': 7,
                'year': 2012
            })
    return render(request, 'app/index.html', {
        'form': form,
        'amount': amount,
        'response': response,
        'title': 'Eway'
    })
Example #9
0
def samurai(request):
    amount = 1
    response= None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("samurai")
            response = merchant.purchase(amount,credit_card)
    else:
        form = CreditCardForm(initial={'number':'4111111111111111'})
    return render(request, 'app/index.html',{'form': form,
                                             'amount':amount,
                                             'response':response,
                                             'title':'Samurai'})
Example #10
0
def stripe(request):
    amount = 1
    response= None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("stripe")
            response = merchant.purchase(amount,credit_card)
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['stripe'])
    return render(request, 'app/index.html',{'form': form,
                                             'amount':amount,
                                             'response':response,
                                             'title':'Stripe Payment'})
Example #11
0
def stripe(request):
    amount = 1
    response= None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("stripe")
            response = merchant.purchase(amount,credit_card)
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['stripe'])
    return render(request, 'app/index.html',{'form': form,
                                             'amount':amount,
                                             'response':response,
                                             'title':'Stripe Payment'})
Example #12
0
def authorize(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = AuthorizeNetGateway()
            # response = merchant.purchase(amount, credit_card)
            response = merchant.recurring(amount, credit_card)
    else:
        form = CreditCardForm(initial={'number':'4222222222222'})
    return render(request, 'app/index.html', {'form': form, 
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Authorize'})
Example #13
0
def samurai(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("samurai")
            response = merchant.purchase(amount, credit_card)
    else:
        form = CreditCardForm(initial={'number': '4111111111111111'})
    return render(request, 'app/index.html', {
        'form': form,
        'amount': amount,
        'response': response,
        'title': 'Samurai'
    })
Example #14
0
def chargebee(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("chargebee")
            response = merchant.purchase(amount, credit_card,
                                         {"plan_id": "professional",
                                          "description": "Quick Purchase"})
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['chargebee'])
    return render(request, 'app/index.html',{'form': form,
                                             'amount': amount,
                                             'response': response,
                                             'title': 'Chargebee'})
Example #15
0
def chargebee(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("chargebee")
            response = merchant.purchase(amount, credit_card,
                                         {"plan_id": "professional",
                                          "description": "Quick Purchase"})
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['chargebee'])
    return render(request, 'app/index.html',{'form': form,
                                             'amount': amount,
                                             'response': response,
                                             'title': 'Chargebee'})
Example #16
0
def braintree(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("braintree_payments")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            response = merchant.purchase(amount, credit_card)
    else:
        form = CreditCardForm(initial={'number':'4111111111111111'})
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Braintree Payments (S2S)'})
Example #17
0
def braintree(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("braintree_payments")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            response = merchant.purchase(amount, credit_card)
    else:
        form = CreditCardForm(initial={'number':'4111111111111111'})
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Braintree Payments (S2S)'})
Example #18
0
def paypal(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("pay_pal")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            # response = merchant.purchase(amount, credit_card, options={'request': request})
            response = merchant.recurring(amount, credit_card, options={'request': request})
    else:
        form = CreditCardForm(initial=GATEWAY_INITIAL['paypal'])
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Paypal'})
Example #19
0
def authorize(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("authorize_net")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            response = merchant.purchase(amount, credit_card)
            #response = merchant.recurring(amount, credit_card)
    else:
        form = CreditCardForm(initial={'number': '4222222222222'})
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Authorize'})
Example #20
0
def authorize(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("authorize_net")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            response = merchant.purchase(amount, credit_card)
            #response = merchant.recurring(amount, credit_card)
    else:
        form = CreditCardForm(initial={'number': '4222222222222'})
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Authorize'})
Example #21
0
def eway(request):
    amount = 1
    response = None
    if request.method == 'POST':
        form = CreditCardForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            credit_card = CreditCard(**data)
            merchant = get_gateway("eway")
            try:
                merchant.validate_card(credit_card)
            except CardNotSupported:
                response = "Credit Card Not Supported"
            billing_address = {'salutation': 'Mr.',
                               'address1': 'test',
                               'address2': ' street',
                               'city': 'Sydney',
                               'state': 'NSW',
                               'company': 'Test Company',
                               'zip': '2000',
                               'country': 'au',
                               'email': '*****@*****.**',
                               'fax': '0267720000',
                               'phone': '0267720000',
                               'mobile': '0404085992',
                               'customer_ref': 'REF100',
                               'job_desc': 'test',
                               'comments': 'any',
                               'url': 'http://www.google.com.au',
                               }
            response = merchant.purchase(amount, credit_card, options={'request': request, 'billing_address': billing_address})
    else:
        form = CreditCardForm(initial={'number':'4444333322221111',
                                       'verification_value': '000',
                                       'month': 7,
                                       'year': 2012})
    return render(request, 'app/index.html', {'form': form,
                                              'amount': amount,
                                              'response': response,
                                              'title': 'Eway'})