예제 #1
0
def __create_brazil_pay_bank_transfer_transaction():
    customer = Customer(firstName='Jose',
                        lastName='Silva',
                        email='*****@*****.**',
                        address='Rua E',
                        address2='1040',
                        city='Maracanau',
                        zip='61919-230',
                        country='BR',
                        state='CE',
                        birthDate='12/04/1979',
                        phone='+5572222312')

    payment = Payment(paymentOption='BrazilPayBankTransfer',
                      holder='Jose Silva',
                      documentId='853.513.468-93',
                      bankCode='hsbc')

    redirectUrls = RedirectUrls(
        returnUrl='http://2000charge.com/message/success.html',
        cancelUrl='http://2000charge.com/message/failure.html')

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 4500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })
예제 #2
0
def __create_credit_card_transaction():
    customer = Customer(id='cus_bd838e3611d34d598',
                        firstName='John',
                        lastName='Doe',
                        email='*****@*****.**',
                        country='US')

    payment = Payment(paymentOption='CreditCard',
                      holder='John Doe',
                      creditCardNumber='4111111111111111',
                      CVV2='222',
                      creditCardType='visa',
                      expirationYear='2019',
                      expirationMonth='12')

    redirectUrls = RedirectUrls(
        returnUrl='http://2000charge.com/message/success.html',
        cancelUrl='http://2000charge.com/message/failure.html')

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })
예제 #3
0
    def test_transaction(self):
        customer = Customer(id="cus_bd838e3611d34d598",
                            firstName="John",
                            lastName="Doe",
                            email="*****@*****.**",
                            country="DE")

        payment = Payment(paymentOption="SEPA",
                          holder="John Doe",
                          iban="BE88271080782541")

        transaction = Transaction(customer=customer,
                                  payment=payment,
                                  amount=500,
                                  currency="EUR",
                                  description="test sepa php sdk",
                                  merchantPassThruData="test_sepa_123",
                                  iPAddress="127.0.0.1")

        assert_equal(transaction.customer.id, "cus_bd838e3611d34d598")
        assert_equal(transaction.customer.firstName, "John")
        assert_equal(transaction.customer.lastName, "Doe")
        assert_equal(transaction.customer.email, "*****@*****.**")
        assert_equal(transaction.customer.country, "DE")

        assert_equal(transaction.payment.paymentOption, "SEPA")
        assert_equal(transaction.payment.holder, "John Doe")
        assert_equal(transaction.payment.iban, "BE88271080782541")

        assert_equal(transaction.amount, 500)
        assert_equal(transaction.currency, "EUR")
        assert_equal(transaction.description, "test sepa php sdk")
        assert_equal(transaction.merchantPassThruData, "test_sepa_123")
        assert_equal(transaction.iPAddress, "127.0.0.1")
def add_customer(request):
    template = loader.get_template('customer/add_customer.html')

    email = request.POST.get("email")
    context = {}

    if email != None:
        customer = Customer.create(
                               {
                                    'firstName': 'John',
                                    'lastName': 'Doe',
                                    'email': email,
                                    'address': 'Rutledge Ave 409',
                                    'city': 'Folsom',
                                    'zip': '19033',
                                    'country': 'US',
                                    'state': 'PA',
                                    'phone': '55555555555',
                                    'created': '2016-03-24T15:19:10.7800694Z'
                               }
        )

        context = {
            'customer': customer
        }

    return HttpResponse(template.render(context, request))
예제 #5
0
def retrieve_customer(request):
    template = loader.get_template('customer/retrieve_customer.html')

    customer_id = request.GET.get("customer_id")

    context = {}

    if customer_id != None:
        customer = Customer.retrieve(customer_id)
        context = {'customer': customer}

    return HttpResponse(template.render(context, request))
예제 #6
0
    def test_customer(self):
        customer = Customer(id='cus_bd838e3611d34d598',
                            firstName='John',
                            lastName='Doe',
                            email='*****@*****.**',
                            country='DE')

        assert_equal(customer.id, 'cus_bd838e3611d34d598')
        assert_equal(customer.firstName, 'John')
        assert_equal(customer.lastName, 'Doe')
        assert_equal(customer.email, '*****@*****.**')
        assert_equal(customer.country, 'DE')
def retrieve_customer(request):
    template = loader.get_template('customer/retrieve_customer.html')

    customer_id = request.GET.get("customer_id")

    context = {}

    if customer_id != None:
        customer = Customer.retrieve(customer_id)
        context = {
            'customer': customer
        }

    return HttpResponse(template.render(context, request))
예제 #8
0
def add_subscription(request):
    template = loader.get_template('subscription/add_subscription.html')

    plan_name = request.POST.get("plan_name")
    plan_amount = request.POST.get("plan_amount")
    email = request.POST.get("email")

    context = {}

    if plan_name != None and plan_name != "" \
        and plan_amount != None and plan_amount != "" \
        and email != None and email != "":

        plan = Plan.create({
            'interval': 1,
            'period': Period.DAY,
            'amount': plan_amount,
            'currency': 'EUR',
            'name': plan_name,
            'description': 'Test plan'
        })

        customer = Customer(firstName='John',
                            lastName='Doe',
                            email=email,
                            country='DE')

        payment = Payment(paymentOption='SEPA',
                          holder='John Doe',
                          iban='BE88271080782541')

        transaction = Transaction.create({
            'customer': customer,
            'payment': payment,
            'amount': 500,
            'currency': 'EUR',
            'description': 'test sepa php sdk',
            'merchantPassThruData': 'test_sepa_123',
            'iPAddress': '127.0.0.1'
        })

        subscription = Subscription.create({
            'paymentId': transaction.payment.id,
            'customerId': transaction.customer.id,
            'planId': plan.id
        })

        context = {'subscription': subscription}

    return HttpResponse(template.render(context, request))
예제 #9
0
def __create_sepa_transaction():
    customer = Customer(id='cus_bd838e3611d34d598',
                        firstName='John',
                        lastName='Doe',
                        email='*****@*****.**',
                        country='DE')

    payment = Payment(paymentOption='SEPA',
                      holder='John Doe',
                      iban='BE88271080782541')

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'description': 'test sepa php sdk',
        'merchantPassThruData': 'test_sepa_123',
        'iPAddress': '127.0.0.1'
    })
예제 #10
0
def __create_directpay_transaction():
    customer = Customer(id='cus_bd838e3611d34d598',
                        firstName='John',
                        lastName='Doe',
                        email='*****@*****.**',
                        country='DE')

    payment = Payment(paymentOption='directpay', holder='John Doe')

    redirectUrls = RedirectUrls(
        returnUrl='http://2000charge.com/message/success.html',
        cancelUrl='http://2000charge.com/message/failure.html')

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 100,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })
예제 #11
0
def add_customer(request):
    template = loader.get_template('customer/add_customer.html')

    email = request.POST.get("email")
    context = {}

    if email != None:
        customer = Customer.create({
            'firstName': 'John',
            'lastName': 'Doe',
            'email': email,
            'address': 'Rutledge Ave 409',
            'city': 'Folsom',
            'zip': '19033',
            'country': 'US',
            'state': 'PA',
            'phone': '55555555555',
            'created': '2016-03-24T15:19:10.7800694Z'
        })

        context = {'customer': customer}

    return HttpResponse(template.render(context, request))
예제 #12
0
def all_customers(request):
    template = loader.get_template('customer/all_customers.html')
    context = {'customers': Customer.all()}

    return HttpResponse(template.render(context, request))
예제 #13
0
def all_customers(request):
    template = loader.get_template('customer/all_customers.html')
    context = {'customers': Customer.all()}

    return HttpResponse(template.render(context, request))