Skip to content

Commit

Permalink
add extra details to charge request
Browse files Browse the repository at this point in the history
  • Loading branch information
nicmollel-ro committed Jun 11, 2024
1 parent c5b26df commit deddc62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions aa_stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class StripeCharge(StripeBasicModel):
source = generic.GenericForeignKey("content_type", "object_id")
statement_descriptor = models.CharField(max_length=22, blank=True)

def charge(self, idempotency_key=None):
def charge(self, idempotency_key=None, payment_uuid=None):
self.refresh_from_db() # to minimize the chance of double charging

if self.is_charged:
Expand All @@ -409,8 +409,15 @@ def charge(self, idempotency_key=None):
metadata = {
"object_id": self.object_id,
"content_type_id": self.content_type_id,
"member_uuid": str(self.user.uuid),
"custody": "roman_api",
}
idempotency_key = "{}-{}-{}".format(metadata["object_id"], metadata["content_type_id"], idempotency_key)
if payment_uuid:
metadata["payment_uuid"] = str(payment_uuid)

idempotency_key = "{}-{}-{}".format(
metadata["object_id"], metadata["content_type_id"], idempotency_key
)

params = {
"amount": self.amount,
Expand Down

0 comments on commit deddc62

Please sign in to comment.