Skip to content

Instantly share code, notes, and snippets.

@PaxPrz
Last active September 23, 2022 03:55
Show Gist options
  • Save PaxPrz/797eb46958d553c995cc7989425a230e to your computer and use it in GitHub Desktop.
Save PaxPrz/797eb46958d553c995cc7989425a230e to your computer and use it in GitHub Desktop.
Example payment
class PaymentProcessor:
...
def pay(self, amount: float, user: int) -> bool:
"""some logic implemented"""
payment = self.run_pay()
return payment.id
from integration.stripe import sync_payment
class PaymentProcessor:
...
def pay(self, amount: float, user: int) -> bool:
"""some logic implemented"""
payment = self.run_pay()
# Code Added by Steve #
if payment.is_success:
sync_payment(payment.id, payment.code, payment.destination, ...)
# Code Added by Steve #
return payment
from integration.stripe import sync_payment
from integration.paypal import sync_payment as sync_paypal_payment
class PaymentProcessor:
...
def pay(self, amount: float, user: int) -> bool:
"""some logic implemented"""
payment = self.run_pay()
# Code Added by Steve #
if payment.is_success:
sync_payment(payment.id, payment.code, payment.destination, ...)
# Code Added by Steve #
# Code Added by John #
if payment.is_success:
sync_paypal_payment(payment.id, payment.destination, payment.amount, ...)
# Code Added by John #
return payment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment