File: pain.008.001.02-cfonb.xml

package info (click to toggle)
tryton-modules-account-payment-sepa-cfonb 4.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 236 kB
  • ctags: 49
  • sloc: xml: 182; python: 181; makefile: 6
file content (106 lines) | stat: -rw-r--r-- 4,710 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:py="http://genshi.edgewall.org/">
    <xi:include href="base.xml"/>
    <xi:include href="base-cfonb.xml"/>
    <!-- version 2 uses BIC instead of BICFI -->
    <py:def function="FinancialInstitution(bank, only_bic=False)">
        <FinInstnId>
            <BIC py:if="bank.bic">${bank.bic}</BIC>
            <py:if test="not only_bic">
                <!-- ClrSysMmbId -->
                <Nm>${bank.party.name[:140]}</Nm>
                <py:with vars="address = bank.party.address_get()">
                    <PstlAdr py:if="address">
                        ${PostalAddress(address)}
                    </PstlAdr>
                </py:with>
            </py:if>
            <Othr py:if="not bank.bic">
                <Id>NOTPROVIDED</Id>
            </Othr>
        </FinInstnId>
        <!-- BrnchId -->
    </py:def>
    <CstmrDrctDbtInitn>
        <GrpHdr>
            <MsgId>${group.number[:35]}</MsgId>
            <CreDtTm>${datetime.datetime.now().replace(microsecond=0).isoformat()}</CreDtTm>
            <NbOfTxs>${sum(len(payments) for _, payments in group.sepa_payments)}</NbOfTxs>
            <CtrlSum>${sum(p.amount for p in group.payments)}</CtrlSum>
            <InitgPty>
                ${PartyIdentification(group.sepa_initiating_party)}
            </InitgPty>
        </GrpHdr>
        <PmtInf py:for="key, payments in group.sepa_payments">
            <PmtInfId>${group.sepa_group_payment_id(key)[:35]}</PmtInfId>
            <PmtMtd>DD</PmtMtd>
            <BtchBookg>${'true' if group.journal.sepa_batch_booking else 'false'}</BtchBookg>
            <NbOfTxs>${len(payments)}</NbOfTxs>
            <CtrlSum>${sum(p.amount for p in payments)}</CtrlSum>
            <PmtTpInf>
                <SvcLvl>
                    <Cd>SEPA</Cd>
                </SvcLvl>
                <LclInstrm>
                    <Cd>${key['scheme']}</Cd>
                </LclInstrm>
                <SeqTp>${key['sequence_type']}</SeqTp>
                <!-- CtgyPurp -->
            </PmtTpInf>
            <ReqdColltnDt>${key['date'].isoformat()}</ReqdColltnDt>
            <Cdtr>
                ${PartyIdentification(group.company.party, id=False)}
            </Cdtr>
            <CdtrAcct>
                ${Account(group.journal.sepa_bank_account_number)}
            </CdtrAcct>
            <CdtrAgt>
                ${FinancialInstitution(group.journal.sepa_bank_account_number.account.bank, only_bic=True)}
            </CdtrAgt>
            <!-- UltmtCdtr -->
            <ChrgBr>${group.journal.sepa_charge_bearer}</ChrgBr>
            <CdtrSchmeId>
                ${PartyIdentification(group.company.party, name=False)}
            </CdtrSchmeId>
            <DrctDbtTxInf py:for="payment in payments">
                <PmtId>
                    <InstrId>${payment.sepa_instruction_id}</InstrId>
                    <EndToEndId>${payment.sepa_end_to_end_id}</EndToEndId>
                </PmtId>
                <InstdAmt py:attrs="{'Ccy': payment.currency.code}">${payment.amount}</InstdAmt>
                <DrctDbtTx>
                    <MndtRltdInf py:with="mandate = payment.sepa_mandate">
                        <MndtId>${mandate.identification}</MndtId>
                        <DtOfSgntr>${mandate.signature_date.isoformat()}</DtOfSgntr>
                        <!-- AmdmntInd -->
                        <!-- AmdmntInfDtls -->
                    </MndtRltdInf>
                </DrctDbtTx>
                <!-- UltmtCdtr -->
                <DbtrAgt>
                    ${FinancialInstitution(payment.sepa_bank_account_number.account.bank, only_bic=True)}
                </DbtrAgt>
                <!-- DbtrAgtAcct -->
                <Dbtr>
                    ${PartyIdentification(payment.party)}
                </Dbtr>
                <DbtrAcct>
                    ${Account(payment.sepa_bank_account_number, currency=False)}
                </DbtrAcct>
                <!-- UltmtDbtr -->
                <!-- Purp -->
                <!-- RgltryRptg -->
                <!-- RltdRmtInf -->
                <RmtInf py:if="payment.sepa_remittance_information">
                    <Ustrd>${payment.sepa_remittance_information[:140]}</Ustrd>
                </RmtInf>
            </DrctDbtTxInf>
        </PmtInf>
    </CstmrDrctDbtInitn>
</Document>