Projet

Général

Profil

0002-toulouse_axel-return-amount_paid-in-invoice-endpoint.patch

Lauréline Guérin, 25 février 2020 14:50

Télécharger (4,49 ko)

Voir les différences:

Subject: [PATCH 2/2] toulouse_axel: return amount_paid in invoice endpoint
 (#40163)

 passerelle/contrib/toulouse_axel/utils.py |  1 +
 tests/data/toulouse_axel/invoices.xml     |  2 +-
 tests/test_toulouse_axel.py               | 14 +++++++++-----
 3 files changed, 11 insertions(+), 6 deletions(-)
passerelle/contrib/toulouse_axel/utils.py
165 165
        data.update({
166 166
            'amount': invoice['RESTEAPAYER'],
167 167
            'total_amount': invoice['MONTANTTOTAL'],
168
            'amount_paid': max(0, invoice['MONTANTTOTAL'] - invoice['RESTEAPAYER']),
168 169
            'created': invoice['DATEEMISSION'],
169 170
            'pay_limit_date': invoice['DATEECHEANCE'],
170 171
            'has_pdf': invoice['EXISTEPDF'] == '1',
tests/data/toulouse_axel/invoices.xml
10 10
      <LIBELLE>PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019</LIBELLE>
11 11
      <IDFACTURATION>4242-35AA</IDFACTURATION>
12 12
      <MONTANTTOTAL>44.94</MONTANTTOTAL>
13
      <RESTEAPAYER>44.94</RESTEAPAYER>
13
      <RESTEAPAYER>4.94</RESTEAPAYER>
14 14
      <IDREGIE>MAREGIE</IDREGIE>
15 15
      <EXISTEPDF>1</EXISTEPDF>
16 16
      <IDFACTURE>42</IDFACTURE>
tests/test_toulouse_axel.py
1517 1517
            'id': 'XXX-42',
1518 1518
            'display_id': '42',
1519 1519
            'label': 'PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019',
1520
            'amount': '44.94',
1520
            'amount': '4.94',
1521 1521
            'total_amount': '44.94',
1522
            'amount_paid': '40.00',
1522 1523
            'online_payment': False,
1523 1524
            'created': '2019-11-12',
1524 1525
            'pay_limit_date': '2019-12-04',
......
1535 1536
                    'LIBELLE': 'PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019',
1536 1537
                    'MONTANTTOTAL': '44.94',
1537 1538
                    'NUMFACTURE': 42,
1538
                    'RESTEAPAYER': '44.94',
1539
                    'RESTEAPAYER': '4.94',
1539 1540
                 }
1540 1541
            }
1541 1542
        },
......
1545 1546
            'label': 'PRESTATIONS PERISCOLAIRES NOVEMBRE 2019',
1546 1547
            'amount': '44.94',
1547 1548
            'total_amount': '44.94',
1549
            'amount_paid': 0,
1548 1550
            'online_payment': False,
1549 1551
            'created': '2019-12-12',
1550 1552
            'pay_limit_date': '2020-01-04',
......
1576 1578
            'label': 'PRESTATIONS PERISCOLAIRES DECEMBRE 2019',
1577 1579
            'amount': '44.94',
1578 1580
            'total_amount': '44.94',
1581
            'amount_paid': 0,
1579 1582
            'online_payment': False,
1580 1583
            'created': '2020-01-12',
1581 1584
            'pay_limit_date': '2020-01-15',
......
1733 1736
        'id': 'XXX-42',
1734 1737
        'display_id': '42',
1735 1738
        'label': 'PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019',
1736
        'amount': '44.94',
1739
        'amount': '4.94',
1737 1740
        'total_amount': '44.94',
1741
        'amount_paid': '40.00',
1738 1742
        'online_payment': False,
1739 1743
        'created': '2019-11-12',
1740 1744
        'pay_limit_date': '2019-12-04',
......
1751 1755
                'LIBELLE': 'PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019',
1752 1756
                'MONTANTTOTAL': '44.94',
1753 1757
                'NUMFACTURE': 42,
1754
                'RESTEAPAYER': '44.94',
1758
                'RESTEAPAYER': '4.94',
1755 1759
            }
1756 1760
        }
1757 1761
    }
......
1924 1928
                'DATEPAIEMENT': '01/01/2020 12:00:00',
1925 1929
                'IDFACTURE': 42,
1926 1930
                'IDREGIEENCAISSEMENT': '',
1927
                'MONTANTPAYE': decimal.Decimal('44.94'),
1931
                'MONTANTPAYE': decimal.Decimal('4.94'),
1928 1932
                'REFERENCE': 'foo',
1929 1933
            }
1930 1934
        }
1931
-