Skip to content
Snippets Groups Projects
Commit 67694561 authored by pedrambiria's avatar pedrambiria
Browse files

[FIX] payment_sips: accept scoreInfo in payment response

After a payment is processed by SIPS, a data object is posted back
to Odoo. The data has a `ScoreInfo` element that has more than one
`=` characters (e.g. `scoreInfo=A3;N;N#SC;N;TRANS=3:2;CUMUL=4500:250000`)
This causes the method `_sips_data_to_object` to break, because there
will be too many values to unpack.

To fix this, we should limit the data split to 2 values. This is the
same method used by SIPS to process data as well.
(See: https://github.com/worldline/Sips-International-non-FR-PHPlibrary/blob/master/lib/Sips/PaymentResponse.php#L73

)

opw-3071315

closes odoo/odoo#107129

X-original-commit: 3dce793ad00b1c0b9f06c705f40e31666db74a06
Signed-off-by: default avatarAntoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: default avatarPedram Bi Ria (pebr) <pebr@odoo.com>
parent b4aa8c6b
Branches
Tags
No related merge requests found
......@@ -150,6 +150,6 @@ class PaymentTransaction(models.Model):
def _sips_notification_data_to_object(self, data):
res = {}
for element in data.split('|'):
key, value = element.split('=')
key, value = element.split('=', 1)
res[key] = value
return res
......@@ -27,6 +27,8 @@ class SipsCommon(PaymentCommon):
f'|guaranteeIndicator=Y|cardCSCResultCode=4D|panExpiryDate=202201'
f'|paymentMeanBrand=VISA|paymentMeanType=CARD|customerIpAddress=111.11.111.11'
f'|maskedPan=4100##########00|returnContext={{"reference": "{cls.reference}"}}'
f'|scoreValue=-3.0|scoreColor=GREEN|scoreInfo=A3;N;N#SC;N;TRANS=3:2;CUMUL=4500:250000'
f'|scoreProfile=25_BUSINESS_SCORE_PRE_AUTHORISATION|scoreThreshold=-7;-5'
f'|holderAuthentRelegation=N|holderAuthentStatus=3D_SUCCESS'
f'|tokenPan=dp528b9xwknujmkw|transactionOrigin=INTERNET|paymentPattern=ONE_SHOT'
f'|customerMobilePhone=null|mandateAuthentMethod=null|mandateUsage=null'
......@@ -37,6 +39,6 @@ class SipsCommon(PaymentCommon):
f'|holderAuthentMethod=NOT_SPECIFIED',
'Encode': '',
'InterfaceVersion': 'HP_2.4',
'Seal': '8a4c1f8b268832600a7bf40ddaa5d487f07d61dea81b8119ab8bab3c8a0861f3',
'Seal': 'eb2a499e1abd07f0d9361418f109d940d6cb7bcbaf6ef9385c28651956c96514',
'locale': 'en',
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment