コード例 #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()
コード例 #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()
コード例 #3
0
ファイル: payment.py プロジェクト: awesto/djangoshop-stripe
 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()
コード例 #4
0
ファイル: payment.py プロジェクト: awesto/djangoshop-paypal
 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()