Files
odoo_source/addons/payment_sips/tests/common.py
T
pedrambiria 5dabdcd5f8 [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#107143

X-original-commit: 3dce793ad00b1c0b9f06c705f40e31666db74a06
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2022-12-05 13:02:24 +01:00

45 lines
2.3 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.payment.tests.common import PaymentCommon
class SipsCommon(PaymentCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.sips = cls._prepare_provider('sips', update_values={
'sips_merchant_id': 'dummy_mid',
'sips_secret': 'dummy_secret',
})
# Override default values
cls.provider = cls.sips
cls.currency = cls.currency_euro
cls.notification_data = {
'Data': f'captureDay=0|captureMode=AUTHOR_CAPTURE|currencyCode=840'
f'|merchantId=002001000000001|orderChannel=INTERNET|responseCode=00'
f'|transactionDateTime=2022-01-19T18:01:06+01:00'
f'|transactionReference={cls.reference}'
f'|keyVersion=1|acquirerResponseCode=00|amount=10000|authorisationId=12345'
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'
f'|transactionActors=null|mandateId=null|captureLimitDate=20220119'
f'|dccStatus=null|dccResponseCode=null|dccAmount=null|dccCurrencyCode=null'
f'|dccExchangeRate=null|dccExchangeRateValidity=null|dccProvider=null'
f'|statementReference=tx20220119170050|panEntryMode=MANUAL|walletType=null'
f'|holderAuthentMethod=NOT_SPECIFIED',
'Encode': '',
'InterfaceVersion': 'HP_2.4',
'Seal': 'eb2a499e1abd07f0d9361418f109d940d6cb7bcbaf6ef9385c28651956c96514',
'locale': 'en',
}