feat: hide authorizer for rental orders, auto-set sale type

Rental orders no longer show the "Authorizer Required?" question or
the Authorizer field. The sale type is automatically set to 'Rentals'
when creating or confirming a rental order. Validation logic also
skips authorizer checks for rental sale type.

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-02-25 23:33:23 -05:00
parent 3c8f83b8e6
commit 14fe9ab716
51 changed files with 4192 additions and 822 deletions

View File

@@ -239,7 +239,8 @@ def build_order_payload(reference, amount, currency, business_id='',
def build_transaction_payload(
action, amount, currency, order_id=None, reference='', funding_source=None
action, amount, currency, order_id=None, reference='',
funding_source=None, business_id='', store_id='',
):
"""Build a Poynt transaction payload for charge/auth/capture.
@@ -249,11 +250,23 @@ def build_transaction_payload(
:param str order_id: The Poynt order UUID (optional).
:param str reference: The Odoo transaction reference.
:param dict funding_source: The funding source / card data (optional).
:param str business_id: The Poynt business UUID (optional).
:param str store_id: The Poynt store UUID (optional).
:return: The Poynt-formatted transaction payload.
:rtype: dict
"""
minor_amount = format_poynt_amount(amount, currency)
context = {
'source': 'WEB',
'sourceApp': 'odoo.fusion_poynt',
'transactionInstruction': 'ONLINE_AUTH_REQUIRED',
}
if business_id:
context['businessId'] = business_id
if store_id:
context['storeId'] = store_id
payload = {
'action': action,
'amounts': {
@@ -263,11 +276,7 @@ def build_transaction_payload(
'cashbackAmount': 0,
'currency': currency.name,
},
'context': {
'source': 'WEB',
'sourceApp': 'odoo.fusion_poynt',
'transactionInstruction': 'ONLINE_AUTH_REQUIRED',
},
'context': context,
'notes': reference,
}
@@ -281,3 +290,44 @@ def build_transaction_payload(
payload['fundingSource'] = funding_source
return payload
def build_token_charge_payload(
action, amount, currency, payment_jwt,
business_id='', store_id='', reference='',
):
"""Build a payload for POST /cards/tokenize/charge.
:param str action: SALE or AUTHORIZE.
:param float amount: Amount in major currency units.
:param recordset currency: Currency record.
:param str payment_jwt: The payment token JWT from /cards/tokenize.
:param str business_id: Poynt business UUID.
:param str store_id: Poynt store UUID.
:param str reference: Optional reference note.
:return: The charge payload dict.
:rtype: dict
"""
minor_amount = format_poynt_amount(amount, currency)
context = {}
if business_id:
context['businessId'] = business_id
if store_id:
context['storeId'] = store_id
payload = {
'action': action,
'context': context,
'amounts': {
'transactionAmount': minor_amount,
'orderAmount': minor_amount,
'currency': currency.name,
},
'fundingSource': {
'cardToken': payment_jwt,
},
}
if reference:
payload['notes'] = reference
return payload