Beispiel #1
0
 def add_stripe_payment(self, charge):
     payment = OrderPayment(order=self,
                            transaction_id=charge['id'],
                            payment_method=StripePayment.namespace)
     assert payment.amount.currency == charge['currency'].upper(
     ), "Currency mismatch"
     payment.amount = payment.amount.__class__(
         Decimal(charge['amount']) / payment.amount.subunits)
     payment.save()
Beispiel #2
0
 def add_gestpay_payment(self, handler):
     """
     Adds a payment object to the order for the given GestPay handler.
     """
     transaction_id = handler.GetBankTransactionID()
     payment = OrderPayment(order=self,
                            transaction_id=transaction_id,
                            payment_method=GestPayPayment.namespace)
     currency = list(CURRENCY_CODES.keys())[list(
         CURRENCY_CODES.values()).index(handler.GetCurrency())]
     assert payment.amount.currency == currency, 'Currency mismatch'
     payment.amount = payment.amount.__class__(Decimal(handler.GetAmount()))
     payment.save()
Beispiel #3
0
 def add_stripe_payment(self, charge):
     payment = OrderPayment(order=self, transaction_id=charge['id'], payment_method=StripePayment.namespace)
     assert payment.amount.currency == charge['currency'].upper(), "Currency mismatch"
     payment.amount = payment.amount.__class__(Decimal(charge['amount']) / payment.amount.subunits)
     payment.save()
Beispiel #4
0
 def add_paypal_payment(self, charge):
     payment = OrderPayment(order=self, transaction_id=charge['id'], payment_method=PayPalPayment.namespace)
     transaction = charge['transactions'][0]
     assert payment.amount.currency == transaction['amount']['currency'].upper(), "Currency mismatch"
     payment.amount = payment.amount.__class__(transaction['amount']['total'])
     payment.save()