Skip to content

Commit

Permalink
feat: add loyalty points to Tx Data
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Jun 23, 2024
1 parent bbed631 commit a734238
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ def get_tx_data(self):
address = frappe.get_doc("Address", party.customer_primary_address).as_dict()
else:
address = {}
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
lpm, lpp, lpa = (
party.get("loyalty_program"),
ref_doc.get("loyalty_points"),
ref_doc.get("loyalty_amount"),
)
if lpm and lpp and lpa:
loyalty_points = [lpm, lpp, lpa]
else:
loyalty_points = None
return frappe._dict(
{
"amount": self.grand_total,
Expand All @@ -201,6 +211,8 @@ def get_tx_data(self):
"reference_docname": self.name,
"payer_contact": contact,
"payer_address": address,
"loyalty_points": loyalty_points,
"discount_amount": ref_doc.get("discount_amount"),
}
)

Expand Down

0 comments on commit a734238

Please sign in to comment.