Fix getting cc details from payment_methods

This commit is contained in:
PCoder 2020-12-31 17:23:43 +05:30
parent 2f98294eab
commit 13f5f576b5

View file

@ -169,8 +169,12 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
def set_stripe_charge(self, stripe_charge): def set_stripe_charge(self, stripe_charge):
self.stripe_charge_id = stripe_charge.id self.stripe_charge_id = stripe_charge.id
self.last4 = stripe_charge.source.last4 if stripe_charge.source is None:
self.cc_brand = stripe_charge.source.brand self.last4 = stripe_charge.payment_method_details.card.last4
self.cc_brand = stripe_charge.payment_method_details.card.brand
else:
self.last4 = stripe_charge.source.last4
self.cc_brand = stripe_charge.source.brand
self.save() self.save()
def set_subscription_id(self, subscription_id, cc_details): def set_subscription_id(self, subscription_id, cc_details):