toulouse-maelis: log we got no invoice on basket validation (#79254)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a4805681a1
commit
1a37984298
|
@ -3803,6 +3803,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
)
|
||||
|
||||
# only one invoice should be returned, create it now to manage cancellation
|
||||
invoice = None
|
||||
if response:
|
||||
for item in response.get('factureLst') or []:
|
||||
invoice = self.invoice_set.create(
|
||||
|
@ -3815,6 +3816,13 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
)
|
||||
self.logger.info("Ajout de %s sur la famille '%s'", repr(invoice), family_id)
|
||||
invoice.match_subscriptions()
|
||||
|
||||
if not invoice:
|
||||
self.logger.error(
|
||||
"Pas de facture à la validation du panier '%s' sur la famille '%s'",
|
||||
post_data['basket_id'],
|
||||
family_id,
|
||||
)
|
||||
return {'data': response}
|
||||
|
||||
@endpoint(
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:validateBasketResponse xmlns:ns2="activity.ws.maelis.sigec.com" xmlns:ns3="bean.persistence.activity.ws.maelis.sigec.com" xmlns:ns4="bean.persistence.school.ws.maelis.sigec.com">
|
||||
<validateBasketResultBean>
|
||||
<idFam>S10055638201</idFam>
|
||||
<idInsLst>S10055641665</idInsLst>
|
||||
<idInsLst>S10055641658</idInsLst>
|
||||
</validateBasketResultBean>
|
||||
</ns2:validateBasketResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -9686,7 +9686,7 @@ def test_delete_basket_not_found(activity_service, con, app):
|
|||
assert resp.json['err_desc'] == "no 'plop' basket on family"
|
||||
|
||||
|
||||
def test_validate_basket(activity_service, con, app, caplog):
|
||||
def test_validate_basket(activity_service, con, app):
|
||||
activity_service.add_soap_response('getFamilyBasket', get_xml_file('R_get_family_basket.xml'))
|
||||
activity_service.add_soap_response('validateBasket', get_xml_file('R_validate_basket.xml'))
|
||||
url = get_endpoint('validate-basket')
|
||||
|
@ -9791,6 +9791,22 @@ def test_validate_basket_not_found(activity_service, con, app):
|
|||
assert resp.json['err_desc'] == "no 'plop' basket on family"
|
||||
|
||||
|
||||
def test_validate_basket_no_invoice(activity_service, con, app, caplog):
|
||||
activity_service.add_soap_response('getFamilyBasket', get_xml_file('R_get_family_basket.xml'))
|
||||
activity_service.add_soap_response('validateBasket', get_xml_file('R_validate_basket_no_invoice.xml'))
|
||||
url = get_endpoint('validate-basket')
|
||||
params = {'basket_id': 'S10055641661'}
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
|
||||
resp = app.post_json(url + '?NameID=local', params=params)
|
||||
assert resp.json['err'] == 0
|
||||
assert caplog.records[-1].levelno == logging.ERROR
|
||||
assert (
|
||||
caplog.records[-1].message
|
||||
== "Pas de facture à la validation du panier 'S10055641661' sur la famille '1312'"
|
||||
)
|
||||
|
||||
|
||||
def test_cancel_basket_invoice_cron(activity_service, invoice_service, con, app, freezer, caplog):
|
||||
def request_check(request):
|
||||
assert request == 'F10055641671'
|
||||
|
|
Loading…
Reference in New Issue