Example #1
0
 def test_update_profile(self):
     self.cim_purchase = self.cim_setup(sub_total=Decimal('20.00'))
     credit_card_number = '4007000000027'
     cc = CreditCardDetail()
     cc.credit_type='Visa'
     cc.expire_month=8
     cc.expire_year=2016
     cc.card_holder = "%s %s" % (self.cim_purchase.purchase.first_name, self.cim_purchase.purchase.last_name)
     result = self.gateway.update_payment_profile(self.cim_purchase, cc, credit_card_number)
     self.assertEqual(result.success, True)
Example #2
0
 def payment_profile(self, cim_purchase):
     credit_card_number = '4007000000027'
     cc = CreditCardDetail()
     cc.credit_type='Visa'
     cc.expire_month=8
     cc.expire_year=2012
     cc.card_holder = "%s %s" % (cim_purchase.purchase.first_name, cim_purchase.purchase.last_name)
     result = self.gateway.create_payment_profile(cim_purchase, cc, credit_card_number)
     cim_purchase.payment_profile_id = result.message
     return cim_purchase
Example #3
0
def make_test_purchase(payment={}, **kwargs):
    purchaseargs = {
        "first_name": 'Mister',
        "last_name": 'Tester',
        "orderno" : "test%03i" % random.randrange(1,100),
        "email" : "*****@*****.**",
        "phone" : "555-555-1234",
        "ship_street1" : "123 Test St.",
        "ship_city" : "Testington",
        "ship_state" : "TX",
        "ship_postal_code" : "55555",
        "ship_country" : "US",
        "bill_street1" : "123 Test St.",
        "bill_city" : "Testington",
        "bill_state" : "TX",
        "bill_postal_code" : "55555",
        "bill_country" : "US",
        "tax" : Decimal("0"),
        "shipping" : Decimal("0"),
    }
    purchaseargs.update(kwargs)
    purchase = Purchase(**purchaseargs)
    purchase.recalc()
    purchase.save()
    if payment:
        for f in ('card_type', 'expire_month', 'expire_year', 'card_number', 'ccv'):
            assert(f in payment)
        p = Payment(purchase = purchase, amount = purchase.total)
        p.save()
        c = CreditCardDetail(
            payment=p, 
            credit_type=payment['card_type'],
            expire_month=payment['expire_month'],
            expire_year=payment['expire_year'],
        )
        if 'card_holder' in payment:
            c.card_holder = payment['card_holder']
        c.storeCC(payment['card_number'])
        c.ccv = payment['ccv']
        c.save()        
        
    return purchase