refactor: explicate intent on make_payment_request interface

This commit is contained in:
David
2024-04-03 00:03:40 +02:00
parent 79a46ad6f8
commit 6d83c11d8e
2 changed files with 11 additions and 5 deletions

View File

@@ -491,10 +491,15 @@ def make_payment_request(**args):
"party_type": args.get("party_type") or "Customer",
"party": args.get("party") or ref_doc.get("customer"),
"bank_account": bank_account,
"make_sales_invoice": args.order_type == "Shopping Cart",
"mute_email": args.mute_email
or args.order_type == "Shopping Cart"
or gateway_account.get("payment_channel", "Email") != "Email",
"make_sales_invoice": (
args.make_sales_invoice # new standard
or args.order_type == "Shopping Cart" # compat for webshop app
),
"mute_email": (
args.mute_email # new standard
or args.order_type == "Shopping Cart" # compat for webshop app
or gateway_account.get("payment_channel", "Email") != "Email"
),
}
)

View File

@@ -194,7 +194,8 @@ class TestPaymentRequest(unittest.TestCase):
dt="Sales Order",
dn=so.name,
payment_gateway_account="_Test Gateway - USD", # email channel
order_type="Shopping Cart",
make_sales_invoice=True,
mute_email=True,
submit_doc=True,
return_doc=True,
)