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:
@@ -253,6 +253,53 @@ class PaymentProvider(models.Model):
|
||||
|
||||
return result
|
||||
|
||||
# === BUSINESS METHODS - TOKENIZE / CHARGE === #
|
||||
|
||||
def _poynt_tokenize_nonce(self, nonce):
|
||||
"""Exchange a Poynt Collect nonce for a long-lived payment token JWT.
|
||||
|
||||
:param str nonce: The one-time nonce from Poynt Collect JS.
|
||||
:return: The tokenize response containing card details, cardId,
|
||||
paymentToken (JWT), and AVS/CVV verification results.
|
||||
:rtype: dict
|
||||
:raises ValidationError: If the tokenize call fails.
|
||||
"""
|
||||
self.ensure_one()
|
||||
return self._poynt_make_request(
|
||||
'POST',
|
||||
'cards/tokenize',
|
||||
payload={'nonce': nonce},
|
||||
)
|
||||
|
||||
def _poynt_charge_token(self, payment_jwt, amount, currency,
|
||||
action='SALE', reference=''):
|
||||
"""Charge a stored payment token JWT via the tokenize/charge endpoint.
|
||||
|
||||
:param str payment_jwt: The payment token JWT from _poynt_tokenize_nonce.
|
||||
:param float amount: The charge amount in major currency units.
|
||||
:param recordset currency: The currency record.
|
||||
:param str action: SALE or AUTHORIZE (default SALE).
|
||||
:param str reference: Optional reference note for the transaction.
|
||||
:return: The transaction result dict from Poynt.
|
||||
:rtype: dict
|
||||
:raises ValidationError: If the charge fails.
|
||||
"""
|
||||
self.ensure_one()
|
||||
payload = poynt_utils.build_token_charge_payload(
|
||||
action=action,
|
||||
amount=amount,
|
||||
currency=currency,
|
||||
payment_jwt=payment_jwt,
|
||||
business_id=self.poynt_business_id,
|
||||
store_id=self.poynt_store_id or '',
|
||||
reference=reference,
|
||||
)
|
||||
return self._poynt_make_request(
|
||||
'POST',
|
||||
'cards/tokenize/charge',
|
||||
payload=payload,
|
||||
)
|
||||
|
||||
# === BUSINESS METHODS - INLINE FORM === #
|
||||
|
||||
def _poynt_get_inline_form_values(self, amount, currency, partner_id, is_validation,
|
||||
|
||||
Reference in New Issue
Block a user