This commit is contained in:
gsinghpal
2026-03-26 15:16:51 -04:00
parent bd7275881f
commit 2563208f53
13 changed files with 329 additions and 15 deletions

View File

@@ -467,7 +467,9 @@ class PoyntController(http.Controller):
def poynt_process_card(self, reference=None, poynt_order_id=None,
card_number=None, exp_month=None, exp_year=None,
cvv=None, cardholder_name=None, card_type=None,
**kwargs):
billing_address=None, billing_city=None,
billing_state=None, billing_zip=None,
billing_country=None, **kwargs):
"""Process a card payment through Poynt Cloud API.
The frontend sends card details which are passed to Poynt for
@@ -503,6 +505,13 @@ class PoyntController(http.Controller):
},
'verificationData': {
'cvData': cvv,
'cardHolderBillingAddress': {
'line1': billing_address or '',
'city': billing_city or '',
'territory': billing_state or '',
'postalCode': billing_zip or '',
'countryCode': billing_country or '',
},
},
'entryDetails': {
'customerPresenceStatus': 'ECOMMERCE',
@@ -510,13 +519,25 @@ class PoyntController(http.Controller):
},
}
action = 'AUTHORIZE' if tx_sudo.provider_id.capture_manually else 'SALE'
provider = tx_sudo.provider_id.sudo()
action = 'AUTHORIZE' if provider.capture_manually else 'SALE'
minor_amount = poynt_utils.format_poynt_amount(
tx_sudo.amount, tx_sudo.currency_id,
)
context = {
'source': 'WEB',
'sourceApp': 'odoo.fusion_poynt',
'transactionInstruction': 'ONLINE_AUTH_REQUIRED',
}
if provider.poynt_business_id:
context['businessId'] = provider.poynt_business_id
if provider.poynt_store_id:
context['storeId'] = provider.poynt_store_id
txn_payload = {
'action': action,
'fundingSourceType': 'CREDIT_DEBIT',
'amounts': {
'transactionAmount': minor_amount,
'orderAmount': minor_amount,
@@ -525,11 +546,7 @@ class PoyntController(http.Controller):
'currency': tx_sudo.currency_id.name,
},
'fundingSource': funding_source,
'context': {
'source': 'WEB',
'sourceApp': 'odoo.fusion_poynt',
'transactionInstruction': 'ONLINE_AUTH_REQUIRED',
},
'context': context,
'notes': reference,
}
@@ -539,7 +556,7 @@ class PoyntController(http.Controller):
'type': 'POYNT_ORDER',
}]
result = tx_sudo.provider_id._poynt_make_request(
result = provider._poynt_make_request(
'POST', 'transactions', payload=txn_payload,
)