0001-payfip_ws-consider-cancelled-transaction-as-still-wa.patch
eopayment/payfip_ws.py | ||
---|---|---|
327 | 327 |
if e.code == 'P5' and delta < threshold: |
328 | 328 |
return PaymentResponse(result=WAITING, signed=True, order_id=transaction_id) |
329 | 329 |
raise e |
330 |
return self.payfip_response_to_eopayment_response(idop, response) |
|
330 |
eopayment_response = self.payfip_response_to_eopayment_response(idop, response) |
|
331 |
# convert CANCELLED to WAITING during the first 20 minutes |
|
332 |
if eopayment_response.result == CANCELLED and delta < threshold: |
|
333 |
eopayment_response.result = WAITING |
|
334 |
eopayment_response.bank_status = ( |
|
335 |
'%s - still waiting as idop is still active' % eopayment_response.bank_status |
|
336 |
) |
|
337 |
return eopayment_response |
|
331 | 338 | |
332 | 339 |
def response(self, query_string, **kwargs): |
333 | 340 |
fields = parse_qs(query_string, True) |
tests/test_payfip_ws.py | ||
---|---|---|
393 | 393 |
assert url == 'https://www.payfip.gouv.fr/tpa/paiementws.web?idop=cc0cb210-1cd4-11ea-8cca-0213ad91a103' |
394 | 394 | |
395 | 395 |
response = backend.response('idop=%s' % payment_id) |
396 |
assert response.result == eopayment.CANCELLED
|
|
397 |
assert response.bank_status == 'cancelled CB' |
|
396 |
assert response.result == eopayment.WAITING
|
|
397 |
assert response.bank_status == 'cancelled CB - still waiting as idop is still active'
|
|
398 | 398 |
assert response.order_id == payment_id |
399 | 399 |
assert response.transaction_id == '201912261758460053903194 cc0cb210-1cd4-11ea-8cca-0213ad91a103' |
400 | 400 | |
... | ... | |
406 | 406 |
response = backend.payment_status( |
407 | 407 |
transaction_id='cc0cb210-1cd4-11ea-8cca-0213ad91a103', transaction_date=now |
408 | 408 |
) |
409 |
assert response.result == eopayment.WAITING |
|
410 |
assert response.bank_status == 'cancelled CB - still waiting as idop is still active' |
|
411 | ||
412 |
freezer.move_to(datetime.timedelta(minutes=20, seconds=1)) |
|
413 | ||
414 |
history.counter = 1 # only the response |
|
415 |
response = backend.payment_status( |
|
416 |
transaction_id='cc0cb210-1cd4-11ea-8cca-0213ad91a103', transaction_date=now |
|
417 |
) |
|
409 | 418 |
assert response.result == eopayment.CANCELLED |
419 |
assert response.bank_status == 'cancelled CB' |
|
410 | 420 | |
411 | 421 | |
412 | 422 |
def test_normalize_objet(): |
413 |
- |