diff --git a/README.md b/README.md index 3ee893a..9ffd5d7 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ We love building payment applications! So after developing the [DTAUS library fo This gem implements the following two messages out of the ISO 20022 standard: -* Credit Transfer Initiation (`pain.001.003.03`, `pain.001.002.03` and `pain.001.001.03`) -* Direct Debit Initiation (`pain.008.003.02`, `pain.008.002.02` and `pain.008.001.02`) +* Credit Transfer Initiation (`pain.001.003.03`, `pain.001.002.03`, `pain.001.001.03`, and `pain.001.001.09`) +* Direct Debit Initiation (`pain.008.003.02`, `pain.008.002.02`, `pain.008.001.02`, and `pain.008.001.08`) -It handles the _Specification of Data Formats_ v3.3 (2019-11-17). +It handles the _Specification of Data Formats_ v3.3 (2019-11-17) and partially v3.7 (2023-11-19). BTW: **pain** is a shortcut for **Pa**yment **In**itiation. @@ -118,7 +118,7 @@ sdd.add_transaction( # OPTIONAL: Enables or disables batch booking, in German "Sammelbuchung / Einzelbuchung" # True or False - batch_booking: true + batch_booking: true, # OPTIONAL: Use a different creditor account # CreditorAccount diff --git a/lib/schema/pain.001.001.09.xsd b/lib/schema/pain.001.001.09.xsd new file mode 100644 index 0000000..3cedce4 --- /dev/null +++ b/lib/schema/pain.001.001.09.xsd @@ -0,0 +1,2423 @@ + + + + + + + + + + + Account Identification 4Choice + Specifies the unique identification of an account as assigned by the account servicer. + + + + + IBAN + International Bank Account Number (IBAN) - identifier used internationally by financial institutions to uniquely identify the account of a customer. Further specifications of the format and content of the IBAN can be found in the standard ISO 13616 "Banking and related financial services - International Bank Account Number (IBAN)" version 1997-10-01, or later revisions. + + + + + + + + + + + + AT-D001 The IBAN of the account of the Originator + + + + + + + + + + + + + + AT-C001 The IBAN of the account of the Beneficiary. + + + + + + + + + Active Or Historic Currency And Amount + A number of monetary units specified in an active or a historic currency where the unit of currency is explicit and compliant with ISO 4217. + + + + + + Currency + A code allocated to a currency by a Maintenance Agency under an international identification scheme, as described in the latest edition of the international standard ISO 4217 "Codes for the representation of currencies and funds". + + + + + + + + + + + + + + + + + + Active Or Historic Currency And Amount _Simple Type + A number of monetary units specified in an active or a historic currency where the unit of currency is explicit and compliant with ISO 4217. + + + + + + + + + + Active Or Historic Currency Code + A code allocated to a currency by a Maintenance Agency under an international identification scheme, as described in the latest edition of the international standard ISO 4217 "Codes for the representation of currencies and funds". + + + + + + + + Amount Type 4Choice + Specifies the amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party. + + + + + Instructed Amount + +Amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party. + +Usage: This amount has to be transported unchanged through the transaction chain. + + + + + + + + + + + + + AT-T002 Amount of the Credit Transfer in Euro. + Only ‘EUR’ is allowed. + Amount must be 0.01 or more and 999999999.99 or less. + The fractional part has a maximum of two digits. + + + + + + + + + Any BICDec 2014Identifier + Code allocated to a financial or non-financial institution by the ISO 9362 Registration Authority, as described in ISO 9362: 2014 - "Banking - Banking telecommunication messages - Business identifier code (BIC)". + + + + + + + + Batch Booking Indicator + Identifies whether the sending party requests a single debit or credit entry per individual transaction or a batch entry for the sum of the amounts of all transactions. + + + + + + BICFIDec 2014Identifier + Code allocated to a financial institution by the ISO 9362 Registration Authority as described in ISO 9362: 2014 - "Banking - Banking telecommunication messages - Business identifier code (BIC)". + + + + + + + + Branch And Financial Institution Identification 6 + Unique and unambiguous identification of a financial institution or a branch of a financial institution. + + + + + Financial Institution Identification + Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme. + + + + + + + + + + + GBIC: Choice elements are defined mandatory, because SEPA rule is: Either BICFI or ‘Other/Identification’ must be +used. + Either 'BICFI' or ‘Other/Identification’ must be used. + + + + + + + + + + + + + + + + + + Cash Account 38 + Provides the details to identify an account. + + + + + Identification + Unique and unambiguous identification for the account between the account owner and the account servicer. + + + + + Currency + +Identification of the currency in which the account is held. + +Usage: Currency should only be used in case one and the same account number covers several currencies +and the initiating party needs to identify which currency needs to be used for settlement on the account. + + + + + + Proxy + Specifies an alternate assumed name for the identification of the account. + + + + + + + + + + + + Only IBAN is allowed. + + + + + + + + + + + AT-P003 The Proxy/alias of the account of the Originator. + AT-P003 can only be provided here under the condition that the Originator is given the possibility to validate the IBAN linked to that Alias/Proxy, prior to the authentication of the instruction unless the Originator and the Originator PSP agreed upfront on another arrangement (e.g., through an amendment of the general terms and conditions). + Furthermore, the Originator PSP must have an agreement with the Originator and the Beneficiary PSP with the Beneficiary in relation to the treatment and the use of the data provided under such Alias/Proxy i.e. whether it is to be used for the purpose to initiate the transaction and/or to forward it to the Beneficiary PSP and/or the Beneficiary concerned. + + + + + + + + + + + + + + Only IBAN is allowed. + + + + + + AT-E003 The Proxy/alias of the account of the Beneficiary. + AT-E003 can only be provided here under the condition that the Originator is given the possibility to validate the IBAN linked to that Alias/Proxy, prior to the authentication of the instruction unless the Originator and the Originator PSP agreed upfront on another arrangement (e.g., through an amendment of the general terms and conditions). + Furthermore, the Originator PSP must have an agreement with the Originator and the Beneficiary PSP with the Beneficiary in relation to the treatment and the use of the data provided under such Alias/Proxy i.e. whether it is to be used for the purpose to initiate the transaction and/or to forward it to the Beneficiary PSP and/or the Beneficiary concerned. + + + + + + + + + Category Purpose 1Choice + +Specifies the high level purpose of the instruction based on a set of pre-defined categories. +Usage: This is used by the initiating party to provide information concerning the processing of the payment. It is likely to trigger special processing by any of the agents involved in the payment chain. + + + + + + Code + Category purpose, as published in an external category purpose code list. + + + + + Proprietary + Category purpose, in a proprietary form. + + + + + + + + + + + + + + + + + + + + + + + + + Charge Bearer Type 1Code + Specifies which party(ies) will pay charges due for processing of the instruction. + + + + + FollowingServiceLevel + Charges are to be applied following the rules agreed in the service level and/or scheme. + + + + + + + Country Code + Code to identify a country, a dependency, or another area of particular geopolitical interest, on the basis of country names obtained from the United Nations (ISO 3166, Alpha-2 code). + + + + + + + + Creditor Reference Information 2 + Reference information provided by the creditor to allow the identification of the underlying documents. + + + + + Type + Specifies the type of creditor reference. + + + + + Reference + +Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction. + +Usage: If available, the initiating party should provide this reference in the structured remittance information, to enable reconciliation by the creditor upon receipt of the amount of money. + +If the business context requires the use of a creditor reference or a payment remit identification, and only one identifier can be passed through the end-to-end chain, the creditor's reference or payment remittance identification should be quoted in the end-to-end transaction identification. + + + + + + + + + + + + + Mandatory if 'Creditor Reference Information' is used. + + + + + + Mandatory if 'Creditor Reference Information' is used. + If a Creditor Reference contains a check digit, the receiving PSP is not required to validate this. + If the receiving PSP validates the check digit and if this validation fails, the PSP may continue its processing and send the transaction to the next party in the chain. + RF Creditor Reference must be used (ISO 11649) in case “ISO” is mentionded under ‘Issuer'. + + + + + + + + + Creditor Reference Type 1Choice + Specifies the type of document referred by the creditor. + + + + + Code + Type of creditor reference, in a coded form. + + + + + + + + + + + + Only "SCOR" is allowed. + + + + + + + + + Creditor Reference Type 2 + Specifies the type of creditor reference. + + + + + Code Or Proprietary + Coded or proprietary format creditor reference type. + + + + + Issuer + Entity that assigns the credit reference type. + + + + + + + + + + + + + + + + + Mandatory if ‘Reference’ is populated with an identifier issued or governed by a known institution. E.g. “ISO” should be mentioned here if ‘Reference’ is populated with a RF Creditor Reference (ISO 11649). + + + + + + + + + Credit Transfer Transaction 34 + Provide further details specific to the individual transaction(s) included in the message. + + + + + Payment Identification + Set of elements used to reference a payment instruction. + + + + + Payment Type Information + Set of elements used to further specify the type of transaction. + + + + + Amount + Amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party. + + + + + Charge Bearer + Specifies which party/parties will bear the charges associated with the processing of the payment transaction. + + + + + Ultimate Debtor + Ultimate party that owes an amount of money to the (ultimate) creditor. + + + + + Creditor Agent + Financial institution servicing an account for the creditor. + + + + + Creditor + Party to which an amount of money is due. + + + + + Creditor Account + Unambiguous identification of the account of the creditor to which a credit entry will be posted as a result of the payment transaction. + + + + + Ultimate Creditor + Ultimate party to which an amount of money is due. + + + + + Purpose + +Underlying reason for the payment transaction. +Usage: Purpose is used by the end-customers, that is initiating party, (ultimate) debtor, (ultimate) creditor to provide information concerning the nature of the payment. Purpose is a content element, which is not used for processing by any of the agents involved in the payment chain. + + + + + + Remittance Information + Information supplied to enable the matching of an entry with the items that the transfer is intended to settle, such as commercial invoices in an accounts' receivable system. + + + + + + + + + + + + + + + + + 'Payment Type Information' must be present either here or directly under ‘Payment Information’. + + + + + + + + + + + Only "SLEV" is allowed. + It is recommended that this element be specified at ‘Payment Information’ level. + + + + + + + + + + + AT-C002 The BIC code of the Beneficiary PSP. + Only 'BICFI' is allowed. + If the BIC is not indicated 'Creditor Agent' structure is not to be used. + + + + + + Mandatory. + + + + + + Mandatory. + + + + + + + + + + + AT-T007 Purpose of the Credit Transfer. + + + + + + AT-T009 The Remittance Information sent by the Originator to the Beneficiary in the Credit Transfer Instruction. + Either ‘Structured’ or ‘Unstructured’ may be present + + + + + + + + + Customer Credit Transfer Initiation V09 + +Scope +The CustomerCreditTransferInitiation message is sent by the initiating party to the forwarding agent or debtor agent. It is used to request movement of funds from the debtor account to a creditor. +Usage +The CustomerCreditTransferInitiation message can contain one or more customer credit transfer instructions. +The CustomerCreditTransferInitiation message is used to exchange: +- One or more instances of a credit transfer initiation; +- Payment transactions that result in book transfers at the debtor agent or payments to another financial institution; +- Payment transactions that result in an electronic cash transfer to the creditor account or in the emission of a cheque. +The message can be used in a direct or a relay scenario: +- In a direct scenario, the message is sent directly to the debtor agent. The debtor agent is the account servicer of the debtor. +- In a relay scenario, the message is sent to a forwarding agent. The forwarding agent acts as a concentrating financial institution. It will forward the CustomerCreditTransferInitiation message to the debtor agent. +The message can also be used by an initiating party that has authority to send the message on behalf of the debtor. This caters for example for the scenario of a payments factory initiating all payments on behalf of a large corporate. +The CustomerCreditTransferInitiation message can be used in domestic and cross-border scenarios. +The CustomerCreditTransferInitiation message must not be used by the debtor agent to execute the credit transfer instruction(s). The FIToFICustomerCreditTransfer message must be used instead. + + + + + + Group Header + Set of characteristics shared by all individual transactions included in the message. + + + + + Payment Information + Set of characteristics that applies to the debit side of the payment transactions included in the credit transfer initiation. + + + + + + + + + + + + + + + + + + + + + + + + + Date And Date Time 2Choice + Choice between a date or a date and time format. + + + + + Date + Specified date. + + + + + Date Time + Specified date and time. + + + + + + + + + + + + + + + + Only allowed for SCTinst + Only UTC time format or local time with UTC offset format can be used. + + + + + + + + + Date And Place Of Birth 1 + Date and place of birth of a person. + + + + + Birth Date + Date on which a person is born. + + + + + Province Of Birth + Province where a person was born. + + + + + City Of Birth + City where a person was born. + + + + + Country Of Birth + Country where a person was born. + + + + + + + Decimal Number + Number of objects represented as a decimal number, for example 0.75 or 45.6. + + + + + + + + + + + + + + + + + + + + Document Type 3Code + Specifies a type of financial or commercial document. + + + + + StructuredCommunicationReference + Document is a structured communication reference provided by the creditor to identify the referred transaction. + + + + + + + + + + + + +Scope +The CustomerCreditTransferInitiation message is sent by the initiating party to the forwarding agent or debtor agent. It is used to request movement of funds from the debtor account to a creditor. + + + + + + + + + + + External Category Purpose 1Code + +Specifies the category purpose, as published in an external category purpose code list. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Local Instrument 1Code + +Specifies the external local instrument code in the format of character string with a maximum length of 35 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Organisation Identification 1Code + +Specifies the external organisation identification scheme name code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Person Identification 1Code + +Specifies the external person identification scheme name code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Proxy Account Type 1Code + +Specifies the external proxy account type code, as published in the proxy account type external code set. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Purpose 1Code + +Specifies the external purpose code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Service Level 1Code + +Specifies the external service level code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + + + + + + + Financial Institution Identification 18 + Specifies the details to identify a financial institution. + + + + + BICFI + Code allocated to a financial institution by the ISO 9362 Registration Authority as described in ISO 9362 "Banking - Banking telecommunication messages - Business identifier code (BIC)". + + + + + Other + Unique identification of an agent, as assigned by an institution, using an identification scheme. + + + + + + + + + + + + AT-D002 The BIC code of the Originator PSP. + + + + + + + + + + + + + + + + + + + + + + + Generic Financial Identification 1 + Information related to an identification of a financial institution. + + + + + Identification + Unique and unambiguous identification of a person. + + + + + + + + + + + + Only "NOTPROVIDED" is allowed. + + + + + + + + + + + + + + Generic Organisation Identification 1 + Information related to an identification of an organisation. + + + + + Identification + Identification assigned by an institution. + + + + + Scheme Name + Name of the identification scheme. + + + + + Issuer + Entity that assigns the identification. + + + + + + + Generic Person Identification 1 + Information related to an identification of a person. + + + + + Identification + Unique and unambiguous identification of a person. + + + + + Scheme Name + Name of the identification scheme. + + + + + Issuer + Entity that assigns the identification. + + + + + + + Group Header 85 + Set of characteristics shared by all individual transactions included in the message. + + + + + Message Identification + +Point to point reference, as assigned by the instructing party, and sent to the next party in the chain to unambiguously identify the message. +Usage: The instructing party has to make sure that MessageIdentification is unique per instructed party for a pre-agreed period. + + + + + + Creation Date Time + Date and time at which the message was created. + + + + + Number Of Transactions + Number of individual transactions contained in the message. + + + + + Control Sum + Total of all individual amounts included in the message, irrespective of currencies. + + + + + Initiating Party + +Party that initiates the payment. + +Usage: This can either be the debtor or the party that initiates the credit transfer on behalf of the debtor. + + + + + + + + + + + + + + + + + + + + + + + + + + + + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + + + + + + Mandatory. + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + The fractional part has a maximum of two digits. + + + + + + + + + + + + + + IBAN2007Identifier + An identifier used internationally by financial institutions to uniquely identify the account of a customer at a financial institution, as described in the latest edition of the international standard ISO 13616: 2007 - "Banking and related financial services - International Bank Account Number (IBAN)". + + + + + + + + ISODate + A particular point in the progression of time in a calendar year expressed in the YYYY-MM-DD format. This representation is defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601. + + + + + + ISODate Time + +A particular point in the progression of time defined by a mandatory date and a mandatory time component, expressed in either UTC time format (YYYY-MM-DDThh:mm:ss.sssZ), local time with UTC offset format (YYYY-MM-DDThh:mm:ss.sss+/-hh:mm), or local time format (YYYY-MM-DDThh:mm:ss.sss). These representations are defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601. +Note on the time format: +1) beginning / end of calendar day +00:00:00 = the beginning of a calendar day +24:00:00 = the end of a calendar day +2) fractions of second in time format +Decimal fractions of seconds may be included. In this case, the involved parties shall agree on the maximum number of digits that are allowed. + + + + + + + LEIIdentifier + Legal Entity Identifier is a code allocated to a party as described in ISO 17442 "Financial Services - Legal Entity Identifier (LEI)". + + + + + + + + Local Instrument 2Choice + Set of elements that further identifies the type of local instruments being requested by the initiating party. + + + + + Code + Specifies the local instrument, as published in an external local instrument code list. + + + + + Proprietary + Specifies the local instrument, as a proprietary code. + + + + + + + + + + + INST for SCTinst + + + + + + + + + + + + + + Max 140Text + Specifies a character string with a maximum length of 140 characters. + + + + + + + + + + + + + + + Max 15Numeric Text + Specifies a numeric string with a maximum length of 15 digits. + + + + + + + + Max 16Text + Specifies a character string with a maximum length of 16 characters. + + + + + + + + + Max 2048Text + Specifies a character string with a maximum length of 2048 characters. + + + + + + + + + Max 2048Text + Specifies a character string with a maximum length of 2048 characters. + + + + + + + + + Max 35Text + Specifies a character string with a maximum length of 35 characters. + + + + + + + + + Max 70Text + Specifies a character string with a maximum length of 70characters. + + + + + + + + + Organisation Identification 29 + Unique and unambiguous way to identify an organisation. + + + + + Any BIC + Business identification code of the organisation. + + + + + LEI + Legal entity identification as an alternate identification for a party. + + + + + Other + Unique identification of an organisation, as assigned by an institution, using an identification scheme. + + + + + + + + + + + + + + + + + + Organisation Identification Scheme Name 1Choice + Sets of elements to identify a name of the organisation identification scheme. + + + + + Code + Name of the identification scheme, in a coded form as published in an external list. + + + + + Proprietary + Name of the identification scheme, in a free text form. + + + + + + + Party 38Choice + Nature or use of the account. + + + + + Organisation Identification + Unique and unambiguous way to identify an organisation. + + + + + Private Identification + Unique and unambiguous identification of a person, for example a passport. + + + + + + + + + + + + Either ‘AnyBIC', 'LEI’ or one occurrence of ‘Other’ is allowed. + + + + + + Either ‘Date and Place of Birth’ or one occurrence of ‘Other’ is allowed. + + + + + + + + + + + + + + Either ‘AnyBIC', 'LEI’ or one occurrence of ‘Other’ is allowed. + + + + + + Either 'Date and Place of Birth' or one occurence of 'Other' is allowed + + + + + + + + + Party Identification 135 + Specifies the identification of a person or an organisation. + + + + + Name + Name by which a party is known and which is usually used to identify that party. + + + + + Postal Address + Information that locates and identifies a specific address, as defined by postal services. + + + + + Identification + Unique and unambiguous identification of a party. + + + + + + + + + + + + 'Name’ is limited to 70 characters in length. + + + + + + + + + + + + + + + + + + + Mandatory. + AT-P001 Name of the Originator + ‘Name’ is limited to 70 characters in length. + + + + + + AT-P005 Address of the Originator + +If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. +A combination of ‘Address Line’ and 'Country’ is allowed; it is recommended when either the Debtor Agent or Creditor Agent is a non-EEA SEPA PSP. +If 'Address Line' is not used, then at least 'Town Name' and 'Country' must be used. + + + + + + + AT-P004 Originator Identification Code + + + + + + + + + + + + + + AT-P006 Name of the Originator Reference Party + ‘Name’ is limited to 70 characters in length. + + + + + + AT-P007 Identification code of the Originator Reference Party + + + + + + + + + + + + + + AT-P006 Name of the Originator Reference Party. + ‘Name’ is limited to 70 characters in length. + + + + + + AT-P007 Identification Code of the Originator Reference Party. + + + + + + + + + + + + + + Mandatory. + AT-E001 Name of the Beneficiary. + ‘Name’ is limited to 70 characters in length. + + + + + + AT-E004 The address of the Beneficiary. + +If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. +A combination of ‘Address Line’ and 'Country’ is allowed. +If 'Address Line' is not used, then at least 'Town Name' and 'Country' must be used. + + + + + + + AT-E005 Beneficiary Identification Code. + + + + + + + + + + + + + + AT-E007 Name of the Beneficiary Reference Party. + ‘Name’ is limited to 70 characters in length. + + + + + + AT-E010 Identification Code of the Beneficiary Reference Party. + + + + + + + + + Payment Identification 6 + Provides further means of referencing a payment transaction. + + + + + Instruction Identification + +Unique identification as assigned by an instructing party for an instructed party to unambiguously identify the instruction. + +Usage: The instruction identification is a point to point reference that can be used between the instructing party and the instructed party to refer to the individual instruction. It can be included in several messages related to the instruction. + + + + + + End To End Identification + +Unique identification assigned by the initiating party to unambiguously identify the transaction. This identification is passed on, unchanged, throughout the entire end-to-end chain. + +Usage: The end-to-end identification can be used for reconciliation or to link tasks relating to the transaction. It can be included in several messages related to the transaction. + + + + + + + + + + + + + + + + + + + + + + + AT-T014 The Originator’s Reference of the Credit Transfer Instruction. + + + + + + + + + + + + + + Payment Instruction 30 + Characteristics that apply to the debit side of the payment transactions included in the credit transfer initiation. + + + + + Payment Information Identification + Unique identification, as assigned by a sending party, to unambiguously identify the payment information group within the message. + + + + + Payment Method + Specifies the means of payment that will be used to move the amount of money. + + + + + Batch Booking + +Identifies whether a single entry per individual transaction or a batch entry for the sum of the amounts of all transactions within the group of a message is requested. +Usage: Batch booking is used to request and not order a possible batch booking. + + + + + + Number Of Transactions + Number of individual transactions contained in the payment information group. + + + + + Control Sum + Total of all individual amounts included in the group, irrespective of currencies. + + + + + Payment Type Information + Set of elements used to further specify the type of transaction. + + + + + Requested Execution Date + +Date at which the initiating party requests the clearing agent to process the payment. +Usage: This is the date on which the debtor's account is to be debited. If payment by cheque, the date when the cheque must be generated by the bank. + + + + + + Debtor + Party that owes an amount of money to the (ultimate) creditor. + + + + + Debtor Account + Unambiguous identification of the account of the debtor to which a debit entry will be made as a result of the transaction. + + + + + Debtor Agent + Financial institution servicing an account for the debtor. + + + + + Ultimate Debtor + Ultimate party that owes an amount of money to the (ultimate) creditor. + + + + + Charge Bearer + Specifies which party/parties will bear the charges associated with the processing of the payment transaction. + + + + + Credit Transfer Transaction Information + Provides information on the individual transaction(s) included in the message. + + + + + + + + + + + + + + + + + + + + + + Only "TRF" is allowed. + + + + + + If present and contains ‘true’, batch booking is requested. If present and contains ‘false’, booking per transaction is requested. + If element is not present, pre-agreed customer-to-PSP conditions apply. + + + + + + Mandatory + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + + + + + + Mandatory. + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + The fractional part has a maximum of two digits. + + + + + + ‘Payment Type Information’ must be present either here or under ‘Credit Transfer Transaction Information’. + + + + + + AT-T013 The Requested Execution Date of the SEPA Credit Transfer instruction. + + + + + + + + + + + + + + + + AT-D002 The BIC code of the Originator PSP. + + + + + + + + + + + Only "SLEV" is allowed. + It is recommended that this element be specified at ‘Payment Information’ level. + + + + + + + + + + + + + + Payment Method 3Code + Specifies the transfer method that will be used to transfer an amount of money. + + + + + CreditTransfer + Transfer of an amount of money in the books of the account servicer. + + + + + + + Payment Type Information 26 + Provides further details of the type of payment. + + + + + Instruction Priority + Indicator of the urgency or order of importance that the instructing party would like the instructed party to apply to the processing of the instruction. + + + + + Service Level + Agreement under which or rules under which the transaction should be processed. + + + + + Local Instrument + +User community specific instrument. + +Usage: This element is used to specify a local instrument, local clearing option and/or further qualify the service or service level. + + + + + + Category Purpose + +Specifies the high level purpose of the instruction based on a set of pre-defined categories. +Usage: This is used by the initiating party to provide information concerning the processing of the payment. It is likely to trigger special processing by any of the agents involved in the payment chain. + + + + + + + + + + + + + If present, pre-agreed customer-to-PSP conditions apply. + + + + + + Usage is recommended. + Only one occurrence is allowed. + + + + + + + + + + + AT-T008 Category purpose of the Credit Transfer + Depending on the agreement between the Originator and the Originator PSP, ‘Category Purpose’ may be forwarded to the Beneficiary PSP. + + + + + + + + + + + + + + Usage is recommended. + Only one occurrence is allowed. + + + + + + + + + + + AT-T008 Category purpose of the Credit Transfer. + Depending on the agreement between the Originator and the Originator PSP, ‘Category Purpose’ may be forwarded to the Beneficiary PSP. + + + + + + + + + Person Identification 13 + Unique and unambiguous way to identify a person. + + + + + Date And Place Of Birth + Date and place of birth of a person. + + + + + Other + Unique identification of a person, as assigned by an institution, using an identification scheme. + + + + + + + + + + + + + + + + + Person Identification Scheme Name 1Choice + Sets of elements to identify a name of the identification scheme. + + + + + Code + Name of the identification scheme, in a coded form as published in an external list. + + + + + Proprietary + Name of the identification scheme, in a free text form. + + + + + + + Postal Address 24 + Information that locates and identifies a specific address, as defined by postal services. + + + + + Department + Identification of a division of a large organisation or building. + + + + + Sub Department + Identification of a sub-division of a large organisation or building. + + + + + Street Name + Name of a street or thoroughfare. + + + + + Building Number + Number that identifies the position of a building on a street. + + + + + Building Name + Name of the building or house. + + + + + Floor + Floor or storey within a building. + + + + + Post Box + Numbered box in a post office, assigned to a person or organisation, where letters are kept until called for. + + + + + Room + Building room number. + + + + + Post Code + Identifier consisting of a group of letters and/or numbers that is added to a postal address to assist the sorting of mail. + + + + + Town Name + Name of a built-up area, with defined boundaries, and a local government. + + + + + Town Location Name + Specific location name within the town. + + + + + District Name + Identifies a subdivision within a country sub-division. + + + + + Country Sub Division + Identifies a subdivision of a country such as state, region, county. + + + + + Country + Nation with its own government. + + + + + Address Line + Information that locates and identifies a specific address, as defined by postal services, presented in free format text. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only two occurrences are allowed. + +If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. +A combination of ‘Address Line’ and 'Country’ is allowed; it is recommended when either Debtor Agent or Creditor Agent is a non-EEA SEPA PSP. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only two occurrences are allowed. + +If 'Address Line' is used, then 'Postal Address' sub-elements other than 'Country' are forbidden. +A combination of 'Address Line' and 'Country' is allowed. + + + + + + + + + + Priority 2Code + Specifies the priority level of an event. + + + + + High + Priority level is high. + + + + + Normal + Priority level is normal. + + + + + + + Proxy Account Identification 1 + Information related to a proxy identification of the account. + + + + + Type + Type of the proxy identification. + + + + + Identification + Identification used to indicate the account identification under another specified name. + + + + + + + + + + + + Proxy Account Type 1Choice + Specifies the scheme used for the identification of an account alias. + + + + + Code + Name of the identification scheme, in a coded form as published in an external list. + + + + + Proprietary + Name of the identification scheme, in a free text form. + + + + + + + Purpose 2Choice + +Specifies the underlying reason for the payment transaction. +Usage: Purpose is used by the end-customers, that is initiating party, (ultimate) debtor, (ultimate) creditor to provide information concerning the nature of the payment. Purpose is a content element, which is not used for processing by any of the agents involved in the payment chain. + + + + + + Code + Underlying reason for the payment transaction, as published in an external purpose code list. + + + + + + + + + + + + In case the transaction is a transfer back related to an earlier executed SEPA Credit Transfer (SCT) Transaction, the code must be "RRCT" or another code meaningful for identifying the SCT as a transfer back. + "RRTP" must be used if the SCT is the result of a received Request-to-Pay message. + + + + + + + + + Remittance Information 16 + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system. + + + + + Unstructured + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in an unstructured form. + + + + + Structured + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in a structured form. + + + + + + + + + + + + Only one occurrence of ‘Unstructured’ is allowed. + ‘Unstructured’ may carry structured remittance information, as agreed between the Originator and the Beneficiary. + If the commercial trade name of the payee is different from its legal name (AT-E001 The name of the Beneficiary), then the commercial trade name must be provided here. The location of where the transaction took place (if different from AT-E004 The address of the Beneficiary) as well as the transaction date and time can also be provided here. Each piece of information must be followed by a slash to clearly differentiate from the other information included under this data element (a special character other than a slash can be used instead (e.g., “+”) in case the slash is used for other purposes). [Example: The Shopping Paradise/Boulevard des Marchands 123/2020-12-24T11:37/Purchase Nr 1234567890AZ - Merry Christmas.] For further information, please refer to “EPC088-22 EPC Guidance Document – Improve Transparency for Retail Payment End-Users”. + + + + + + ‘Structured’ can be used, provided the tags and the data within the ‘Structured’ element (i.e. excluding <Strd> and </Strd>) do not exceed 140 characters in length. + Only one occurrence of ‘Structured’ is allowed. + + + + + + + + + Service Level 8Choice + Specifies the service level of the transaction. + + + + + Code + Specifies a pre-agreed service or level of service between the parties, as published in an external service level code list. + + + + + + + + + + + SEPA for SCT and SCTinst + AT-T001 Identification code of the Scheme. + + + + + + + + + Structured Remittance Information 16 + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in a structured form. + + + + + Creditor Reference Information + Reference information provided by the creditor to allow the identification of the underlying documents. + + + + + + + + + + + + When present, the Debtor PSP is not obliged to validate the reference information. + When used both ‘Type’ and ‘Reference’ must be present. + + + + + + + diff --git a/lib/schema/pain.008.001.08.xsd b/lib/schema/pain.008.001.08.xsd new file mode 100644 index 0000000..1c48f6e --- /dev/null +++ b/lib/schema/pain.008.001.08.xsd @@ -0,0 +1,2705 @@ + + + + + + + + + + + Account Identification 4Choice + Specifies the unique identification of an account as assigned by the account servicer. + + + + + IBAN + International Bank Account Number (IBAN) - identifier used internationally by financial institutions to uniquely identify the account of a customer. Further specifications of the format and content of the IBAN can be found in the standard ISO 13616 "Banking and related financial services - International Bank Account Number (IBAN)" version 1997-10-01, or later revisions. + + + + + Other + Unique identification of an account, as assigned by the account servicer, using an identification scheme. + + + + + + + + + + + + + + + + Active Or Historic Currency And Amount + A number of monetary units specified in an active or a historic currency where the unit of currency is explicit and compliant with ISO 4217. + + + + + + Currency + A code allocated to a currency by a Maintenance Agency under an international identification scheme, as described in the latest edition of the international standard ISO 4217 "Codes for the representation of currencies and funds". + + + + + + + + + + + + + + + + + + Active Or Historic Currency And Amount _Simple Type + A number of monetary units specified in an active or a historic currency where the unit of currency is explicit and compliant with ISO 4217. + + + + + + + + + + Active Or Historic Currency Code + A code allocated to a currency by a Maintenance Agency under an international identification scheme, as described in the latest edition of the international standard ISO 4217 "Codes for the representation of currencies and funds". + + + + + + + + + + + Euro + + + + + + + Amendment Information Details 13 + Provides further details on the list of direct debit mandate elements that have been modified when the amendment indicator has been set. + + + + + Original Mandate Identification + Unique identification, as assigned by the creditor, to unambiguously identify the original mandate. + + + + + Original Creditor Scheme Identification + Original creditor scheme identification that has been modified. + + + + + Original Debtor Account + Original debtor account that has been modified. + + + + + Original Debtor Agent + Original debtor agent that has been modified. + + + + + + + + + + + + AT-M005 The Unique Mandate Reference as given by the Original Creditor who issued the Mandate. + Mandatory if changes occur in ‘Mandate Identification’, otherwise not to be used. + + + + + + + + + + + Mandatory if changes occur in ‘Creditor Scheme Identification’ and or ‘Name’, otherwise not to be used. + + + + + + To use ‘Identification’ under ‘Other’ under ‘Identification’ with code "SMNDA" (Same Mandate with a New Debtor Account) to indicate same mandate with new Debtor Account. Or + In case of an account change within the same PSP, IBAN is allowed. + + + + + + Not to be used if element 'Original Debtor Account' is populated with "SMNDA" (Same Mandate with a New Debtor Account). + + + + + + + + + Any BICDec 2014Identifier + Code allocated to a financial or non-financial institution by the ISO 9362 Registration Authority, as described in ISO 9362: 2014 - "Banking - Banking telecommunication messages - Business identifier code (BIC)". + + + + + + + + Batch Booking Indicator + Identifies whether the sending party requests a single debit or credit entry per individual transaction or a batch entry for the sum of the amounts of all transactions. + + + + + + BICFIDec 2014Identifier + Code allocated to a financial institution by the ISO 9362 Registration Authority as described in ISO 9362: 2014 - "Banking - Banking telecommunication messages - Business identifier code (BIC)". + + + + + + + + Branch And Financial Institution Identification 6 + Unique and unambiguous identification of a financial institution or a branch of a financial institution. + + + + + Financial Institution Identification + Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme. + + + + + + + + + + + GBIC: Choice elements are defined mandatory, because SEPA rule is: Either BICFI or ‘Other/Identification’ must be +used. + Either 'BICFI' or ‘Other/Identification’ must be used. + + + + + + + + + + + + + GBIC: Choice elements are defined mandatory, because SEPA rule is: Either BICFI or ‘Other/Identification’ must be +used. + Either 'BICFI' or ‘Other/Identification’ must be used. + + + + + + + + + Cash Account 38 + Provides the details to identify an account. + + + + + Identification + Unique and unambiguous identification for the account between the account owner and the account servicer. + + + + + Currency + +Identification of the currency in which the account is held. + +Usage: Currency should only be used in case one and the same account number covers several currencies +and the initiating party needs to identify which currency needs to be used for settlement on the account. + + + + + + + + + + + + + Only IBAN is allowed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category Purpose 1Choice + +Specifies the high level purpose of the instruction based on a set of pre-defined categories. +Usage: This is used by the initiating party to provide information concerning the processing of the payment. It is likely to trigger special processing by any of the agents involved in the payment chain. + + + + + + Code + Category purpose, as published in an external category purpose code list. + + + + + Proprietary + Category purpose, in a proprietary form. + + + + + + + + + + + + + + + + + + + + + + + + + Charge Bearer Type 1Code + Specifies which party(ies) will pay charges due for processing of the instruction. + + + + + FollowingServiceLevel + Charges are to be applied following the rules agreed in the service level and/or scheme. + + + + + + + Country Code + Code to identify a country, a dependency, or another area of particular geopolitical interest, on the basis of country names obtained from the United Nations (ISO 3166, Alpha-2 code). + + + + + + + + Creditor Reference Information 2 + Reference information provided by the creditor to allow the identification of the underlying documents. + + + + + Type + Specifies the type of creditor reference. + + + + + Reference + +Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction. + +Usage: If available, the initiating party should provide this reference in the structured remittance information, to enable reconciliation by the creditor upon receipt of the amount of money. + +If the business context requires the use of a creditor reference or a payment remit identification, and only one identifier can be passed through the end-to-end chain, the creditor's reference or payment remittance identification should be quoted in the end-to-end transaction identification. + + + + + + + + + + + + + Mandatory if 'Creditor Reference Information' is used. + + + + + + Mandatory if 'Creditor Reference Information' is used. + If ‘Creditor’ Reference contains a check digit, the receiving PSP is not required to validate this. + If the receiving PSP validates the check digit and if this validation fails, the PSP may continue its processing and send the transaction to the next party in the chain. + RF Creditor Reference may be used (ISO 11649). + + + + + + + + + Creditor Reference Type 1Choice + Specifies the type of document referred by the creditor. + + + + + Code + Type of creditor reference, in a coded form. + + + + + + + + + + + + Only "SCOR" is allowed. + + + + + + + + + Creditor Reference Type 2 + Specifies the type of creditor reference. + + + + + Code Or Proprietary + Coded or proprietary format creditor reference type. + + + + + Issuer + Entity that assigns the credit reference type. + + + + + + + + + + + + + + + + + + + + + + + + + Customer Direct Debit Initiation V08 + +Scope +The CustomerDirectDebitInitiation message is sent by the initiating party to the forwarding agent or creditor agent. It is used to request single or bulk collection(s) of funds from one or various debtor's account(s) for a creditor. +Usage +The CustomerDirectDebitInitiation message can contain one or more direct debit instructions. +The message can be used in a direct or a relay scenario: +- In a direct scenario, the message is sent directly to the creditor agent. The creditor agent is the account servicer of the creditor. +- In a relay scenario, the message is sent to a forwarding agent. The forwarding agent acts as a concentrating financial institution. It will forward the CustomerDirectDebitInitiation message to the creditor agent. +The message can also be used by an initiating party that has authority to send the message on behalf of the creditor. This caters for example for the scenario of a payments factory initiating all payments on behalf of a large corporate. +The CustomerDirectDebitInitiation message can be used in domestic and cross-border scenarios. +The CustomerDirectDebitInitiation may or may not contain mandate related information, i.e. extracts from a mandate, such as MandateIdentification or DateOfSignature. The CustomerDirectDebitInitiation message must not be considered as a mandate. +The CustomerDirectDebitInitiation message must not be used by the creditor agent to execute the direct debit instruction(s). The FIToFICustomerDirectDebit message must be used instead. + + + + + + Group Header + Set of characteristics shared by all individual transactions included in the message. + + + + + Payment Information + Set of characteristics that apply to the credit side of the payment transactions included in the direct debit transaction initiation. + + + + + + + + + + + + + + + + + + + + + + + + + Date And Place Of Birth 1 + Date and place of birth of a person. + + + + + Birth Date + Date on which a person is born. + + + + + Province Of Birth + Province where a person was born. + + + + + City Of Birth + City where a person was born. + + + + + Country Of Birth + Country where a person was born. + + + + + + + Decimal Number + Number of objects represented as a decimal number, for example 0.75 or 45.6. + + + + + + + + + + + + + + + Direct Debit Transaction 10 + Provides further specific details on the direct debit transaction and the related mandate. + + + + + Mandate Related Information + Provides further details of the direct debit mandate signed between the creditor and the debtor. + + + + + Creditor Scheme Identification + Credit party that signs the mandate. + + + + + + + + + + + + Mandatory. + + + + + + It is recommended that all transactions within the same ‘Payment Information’ block have the same ‘Creditor Scheme Identification’. + This data element must be present at either ‘Payment Information’ or ‘Direct Debit Transaction’ level. + + + + + + + + + Direct Debit Transaction Information 23 + Provides further details specific to the individual direct debit transaction(s) included in the message. + + + + + Payment Identification + Set of elements used to reference a payment instruction. + + + + + Payment Type Information + Set of elements used to further specify the type of transaction. + + + + + Instructed Amount + +Amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party. +Usage: This amount has to be transported unchanged through the transaction chain. + + + + + + Charge Bearer + Specifies which party/parties will bear the charges associated with the processing of the payment transaction. + + + + + Direct Debit Transaction + Provides information specific to the direct debit mandate. + + + + + Ultimate Creditor + Ultimate party to which an amount of money is due. + + + + + Debtor Agent + Financial institution servicing an account for the debtor. + + + + + Debtor + Party that owes an amount of money to the (ultimate) creditor. + + + + + Debtor Account + Unambiguous identification of the account of the debtor to which a debit entry will be made as a result of the transaction. + + + + + Ultimate Debtor + Ultimate party that owes an amount of money to the (ultimate) creditor. + + + + + Purpose + +Underlying reason for the payment transaction. +Usage: Purpose is used by the end-customers, that is initiating party, (ultimate) debtor, (ultimate) creditor to provide information concerning the nature of the payment. Purpose is a content element, which is not used for processing by any of the agents involved in the payment chain. + + + + + + Remittance Information + Information supplied to enable the matching of an entry with the items that the transfer is intended to settle, such as commercial invoices in an accounts' receivable system. + + + + + + + + + + + + + + + + + ‘Payment Type Information’ must be present either here or directly under ‘Payment Information’. + + + + + + AT-T002 The Amount of the Collection in Euro. + Only ‘EUR’ is allowed. + Amount must be 0.01 or more and 999999999.99 or less. + The fractional part has a maximum of two digits. + + + + + + Only "SLEV" is allowed. + + + + + + Mandatory. + + + + + + This data element may be present either at ‘Payment Information’ or at ‘Direct Debit Transaction Information’ level. + + + + + + + + + + + + + + + + AT-D001 The account number (IBAN) of the Debtor. + Only IBAN is allowed. + + + + + + Mandatory, if provided by the Debtor in the Mandate. + + + + + + AT-T007 The Purpose of the Collection. + + + + + + AT-T012 The Remittance information sent by the Creditor to the Debtor in the Collection. + Either ‘Structured’ or ‘Unstructured’, may be present. + + + + + + + + + + + + + + Document Type 3Code + Specifies a type of financial or commercial document. + + + + + StructuredCommunicationReference + Document is a structured communication reference provided by the creditor to identify the referred transaction. + + + + + + + + + + + + +Scope +The CustomerDirectDebitInitiation message is sent by the initiating party to the forwarding agent or creditor agent. It is used to request single or bulk collection(s) of funds from one or various debtor's account(s) for a creditor. + + + + + + + + + + External Category Purpose 1Code + +Specifies the category purpose, as published in an external category purpose code list. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Local Instrument 1Code + +Specifies the external local instrument code in the format of character string with a maximum length of 35 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + + + + + Transaction is related to SEPA direct debit -core. + SEPADirectDebitCore + + + + + Transaction is related to SEPA business to business direct debit. + SEPABusinessToBusinessDirectDebit + + + + + + + External Organisation Identification 1Code + +Specifies the external organisation identification scheme name code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Person Identification 1Code + +Specifies the external person identification scheme name code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Purpose 1Code + +Specifies the external purpose code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + External Service Level 1Code + +Specifies the external service level code in the format of character string with a maximum length of 4 characters. +The list of valid codes is an external code list published separately. +External code sets can be downloaded from www.iso20022.org. + + + + + + + + + + + + + + Payment must be executed following the Single Euro Payments Area scheme. + SingleEuroPaymentsArea + + + + + + + Financial Institution Identification 18 + Specifies the details to identify a financial institution. + + + + + BICFI + Code allocated to a financial institution by the ISO 9362 Registration Authority as described in ISO 9362 "Banking - Banking telecommunication messages - Business identifier code (BIC)". + + + + + Other + Unique identification of an agent, as assigned by an institution, using an identification scheme. + + + + + + + + + + + + AT-C002 BIC code of the Creditor PSP. + + + + + + + + + + + + + + + + + + + AT-D002 BIC code of the Debtor PSP. + + + + + + + + + + + + + + Generic Account Identification 1 + Information related to a generic account identification. + + + + + Identification + Identification assigned by an institution. + + + + + + + Generic Financial Identification 1 + Information related to an identification of a financial institution. + + + + + Identification + Unique and unambiguous identification of a person. + + + + + + + + + + + + Only "NOTPROVIDED" is allowed. + + + + + + + + + + + + + + + + + + + Only "NOTPROVIDED" is allowed. + + + + + + + + + + + + + + Generic Organisation Identification 1 + Information related to an identification of an organisation. + + + + + Identification + Identification assigned by an institution. + + + + + Scheme Name + Name of the identification scheme. + + + + + Issuer + Entity that assigns the identification. + + + + + + + Generic Person Identification 1 + Information related to an identification of a person. + + + + + Identification + Unique and unambiguous identification of a person. + + + + + Scheme Name + Name of the identification scheme. + + + + + Issuer + Entity that assigns the identification. + + + + + + + + + + + + + + + + + + + + + + + Group Header 83 + Set of characteristics shared by all individual transactions included in the message. + + + + + Message Identification + +Point to point reference, assigned by the instructing party and sent to the next party in the chain, to unambiguously identify the message. + +Usage: The instructing party has to make sure that MessageIdentification is unique per instructed party for a pre-agreed period. + + + + + + Creation Date Time + Date and time at which the message was created. + + + + + Number Of Transactions + Number of individual transactions contained in the message. + + + + + Control Sum + Total of all individual amounts included in the message, irrespective of currencies. + + + + + Initiating Party + +Party that initiates the payment. + +Usage: This can either be the creditor or a party that initiates the direct debit on behalf of the creditor. + + + + + + + + + + + + + + + + + + + + + + + + + + + + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + + + + + + Mandatory. + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + The fractional part has a maximum of two digits + + + + + + + + + + + + + + IBAN2007Identifier + An identifier used internationally by financial institutions to uniquely identify the account of a customer at a financial institution, as described in the latest edition of the international standard ISO 13616: 2007 - "Banking and related financial services - International Bank Account Number (IBAN)". + + + + + + + + ISODate + A particular point in the progression of time in a calendar year expressed in the YYYY-MM-DD format. This representation is defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601. + + + + + + ISODate Time + +A particular point in the progression of time defined by a mandatory date and a mandatory time component, expressed in either UTC time format (YYYY-MM-DDThh:mm:ss.sssZ), local time with UTC offset format (YYYY-MM-DDThh:mm:ss.sss+/-hh:mm), or local time format (YYYY-MM-DDThh:mm:ss.sss). These representations are defined in "XML Schema Part 2: Datatypes Second Edition - W3C Recommendation 28 October 2004" which is aligned with ISO 8601. +Note on the time format: +1) beginning / end of calendar day +00:00:00 = the beginning of a calendar day +24:00:00 = the end of a calendar day +2) fractions of second in time format +Decimal fractions of seconds may be included. In this case, the involved parties shall agree on the maximum number of digits that are allowed. + + + + + + + LEIIdentifier + Legal Entity Identifier is a code allocated to a party as described in ISO 17442 "Financial Services - Legal Entity Identifier (LEI)". + + + + + + + + Local Instrument 2Choice + Set of elements that further identifies the type of local instruments being requested by the initiating party. + + + + + Code + Specifies the local instrument, as published in an external local instrument code list. + + + + + + + + + + + + AT-T001 The identification code of the Scheme. + Only "CORE" is allowed. + The mixing of different Local Instrument values is not allowed in the same message. + + + + + + + + + + + + + + AT-T001 The identification code of the Scheme. + Only "CORE" is allowed. + The mixing of different Local Instrument values is not allowed in the same message. + + + + + + + + + Mandate Related Information 14 + Provides further details related to a direct debit mandate signed between the creditor and the debtor. + + + + + Mandate Identification + Unique identification, as assigned by the creditor, to unambiguously identify the mandate. + + + + + Date Of Signature + Date on which the direct debit mandate has been signed by the debtor. + + + + + Amendment Indicator + Indicator notifying whether the underlying mandate is amended or not. + + + + + Amendment Information Details + List of mandate elements that have been modified. + + + + + Electronic Signature + Additional security provisions, such as a digital signature, as provided by the debtor. + + + + + + + + + + + + Mandatory. + AT-M001 The Unique Mandate Reference. + + + + + + + + + + + Mandatory. + AT-M008 The Date of Signing of the Mandate. + + + + + + + + + + + AT-M007 The Reason for Amendment of the Mandate. + Mandatory if ‘Amendment Indicator’ is "true". + The reason from the Rulebook is indicated by using the following message sub-elements. + + + + + + AT-M010 The Placeholder for the electronic signature data, if applicable. + AT-M002 The Type of Mandate (paper, e-Mandate). + AT-M013 The Reference of the validation made by the Debtor PSP (if present in DS-03). + If the direct debit is based on an EPC electronic mandate, this data element must contain AT-M013 which is the reference to the Mandate Acceptance Report made by the Debtor PSP. + This data element is not to be used if the mandate is a paper mandate. + + + + + + + + + Max 1025Text + Specifies a character string with a maximum length of 1025 characters. + + + + + + + + + Max 140Text + Specifies a character string with a maximum length of 140 characters. + + + + + + + + + + + + + + + Max 15Numeric Text + Specifies a numeric string with a maximum length of 15 digits. + + + + + + + + Max 16Text + Specifies a character string with a maximum length of 16 characters. + + + + + + + + + Max 34Text + Specifies a character string with a maximum length of 34 characters. + + + + + + + + + Max 35Text + Specifies a character string with a maximum length of 35 characters. + + + + + + + + + Max 70Text + Specifies a character string with a maximum length of 70characters. + + + + + + + + + Organisation Identification 29 + Unique and unambiguous way to identify an organisation. + + + + + Any BIC + Business identification code of the organisation. + + + + + LEI + Legal entity identification as an alternate identification for a party. + + + + + Other + Unique identification of an organisation, as assigned by an institution, using an identification scheme. + + + + + + + + + + + + + + + + + + Organisation Identification Scheme Name 1Choice + Sets of elements to identify a name of the organisation identification scheme. + + + + + Code + Name of the identification scheme, in a coded form as published in an external list. + + + + + Proprietary + Name of the identification scheme, in a free text form. + + + + + + + Party 38Choice + Nature or use of the account. + + + + + Organisation Identification + Unique and unambiguous way to identify an organisation. + + + + + Private Identification + Unique and unambiguous identification of a person, for example a passport. + + + + + + + + + + + + Either ‘AnyBIC’, 'LEI' or one occurrence of ‘Other’ is allowed. + + + + + + Either ‘Date and Place of Birth’ or one occurrence of ‘Other’ is allowed. + + + + + + + + + + + + + + Mandatory. + Private Identification is used to identify either an organisation or a private person. + + + + + + + + + + + + + + Private Identification is used to identify either an organisation or a private person. + + + + + + + + + + + + + + Either ‘AnyBICI’, 'LEI' or one occurrence of ‘Other’ is allowed. + + + + + + Either ‘Date and Place of Birth’ or one occurrence of ‘Other’ is allowed. + + + + + + + + + Party Identification 135 + Specifies the identification of a person or an organisation. + + + + + Name + Name by which a party is known and which is usually used to identify that party. + + + + + Postal Address + Information that locates and identifies a specific address, as defined by postal services. + + + + + Identification + Unique and unambiguous identification of a party. + + + + + + + + + + + + ‘Name’ is limited to 70 characters in length. + + + + + + + + + + + + + + + + + + + Mandatory. + AT-E001 The Name of the Creditor. + ‘Name’ is limited to 70 characters in length. + + + + + + AT-E004 The Address of the Creditor. + +If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. +A combination of ‘Address Line’ and 'Country’ is allowed. +If 'Address Line' is not used, then at least 'Town Name' and 'Country' must be used. + + + + + + + + + + + + + + + AT-E007 The Name of the Creditor Reference Party. + ‘Name’ is limited to 70 characters in length. + + + + + + AT-E010 The Identification code of the Creditor Reference Party. + + + + + + + + + + + + + + Mandatory. + AT-E005 The Identifier of the Creditor. + + + + + + + + + + + + + + Original AT-E001 The Name of the Creditor. + If present the new’ Name’ must be specified under ‘Creditor’. + ‘Name’ is limited to 70 characters in length. + + + + + + AT-M004 The Identifier of the original Creditor who issued the Mandate. + + + + + + + + + + + + + + Mandatory. + AT-E005 The Identifier of the Creditor. + + + + + + + + + + + + + + Mandatory. + AT-P001 The Name of the Debtor. + ‘Name’ is limited to 70 characters in length. + In case of a mandate generated using data from a payment card at the point of sale which results in a direct debit to and from a payment account, and where the name of the Debtor is not available, the attribute “Name of the Debtor” must be filled in with “/CDGM” (note: Card Data Generated Mandate), followed by “/card number”, “/sequence number” and “/expiry date of the card” (note: this means that the information parts are delimited by “/”) or, if these data elements are not available, by any other data element(s) that would uniquely identify the Debtor to the Debtor PSP. + + + + + + AT-P005 The Address of the Debtor (only mandatory when the Creditor PSP or the Debtor PSP is located a non-EEA SEPA country or territory). + +If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. +A combination of ‘Address Line’ and 'Country’ is allowed; it is recommended when either the Debtor Agent or Creditor Agent is a non-EEA SEPA PSP. +If 'Address Line' is not used, then at least 'Town Name' and 'Country' must be used. + + + + + + + AT-P004 Debtor identification code. + + + + + + + + + + + + + + AT-P006 The Name of the Debtor Reference Party. + ‘Name’ is limited to 70 characters in length. + Mandatory if provided by the Debtor in the mandate. + + + + + + AT-P007 The Identification code of the Debtor Reference Party. + + + + + + + + + Payment Identification 6 + Provides further means of referencing a payment transaction. + + + + + Instruction Identification + +Unique identification as assigned by an instructing party for an instructed party to unambiguously identify the instruction. + +Usage: The instruction identification is a point to point reference that can be used between the instructing party and the instructed party to refer to the individual instruction. It can be included in several messages related to the instruction. + + + + + + End To End Identification + +Unique identification assigned by the initiating party to unambiguously identify the transaction. This identification is passed on, unchanged, throughout the entire end-to-end chain. + +Usage: The end-to-end identification can be used for reconciliation or to link tasks relating to the transaction. It can be included in several messages related to the transaction. + + + + + + + + + + + + + + + + + + + + + + + AT-T015 The Creditor’s reference of the Direct Debit Transaction. + + + + + + + + + + + + + + Payment Instruction 29 + Characteristics that apply to the credit side of the payment transactions included in the direct debit initiation. + + + + + Payment Information Identification + Unique identification, as assigned by a sending party, to unambiguously identify the payment information group within the message. + + + + + Payment Method + Specifies the means of payment that will be used to move the amount of money. + + + + + Batch Booking + +Identifies whether a single entry per individual transaction or a batch entry for the sum of the amounts of all transactions within the group of a message is requested. +Usage: Batch booking is used to request and not order a possible batch booking. + + + + + + Number Of Transactions + Number of individual transactions contained in the payment information group. + + + + + Control Sum + Total of all individual amounts included in the group, irrespective of currencies. + + + + + Payment Type Information + Set of elements used to further specify the type of transaction. + + + + + Requested Collection Date + Date and time at which the creditor requests that the amount of money is to be collected from the debtor. + + + + + Creditor + Party to which an amount of money is due. + + + + + Creditor Account + Unambiguous identification of the account of the creditor to which a credit entry will be posted as a result of the payment transaction. + + + + + Creditor Agent + Financial institution servicing an account for the creditor. + + + + + Ultimate Creditor + Ultimate party to which an amount of money is due. + + + + + Charge Bearer + Specifies which party/parties will bear the charges associated with the processing of the payment transaction. + + + + + Creditor Scheme Identification + Credit party that signs the mandate. + + + + + Direct Debit Transaction Information + Provides information on the individual transaction(s) included in the message. + + + + + + + + + + + + + + + + + + + + + + + + + + + If present and contains "true", batch booking is requested. If present and contains "false", booking per transaction is requested. + If element is not present, pre-agreed customer-to-PSP conditions apply. + + + + + + Mandatory. + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + + + + + + Mandatory. + The validation of this data element depends on pre-agreed customer-to-PSP conditions. + The fractional part has a maximum of two digits + + + + + + ‘Payment Type Information’ must be present either here or under ‘Direct Debit Transaction Information’. + + + + + + AT-T013 The Due Date of the Collection. + + + + + + + + + + + AT-C001 The account number (IBAN) of the Creditor. + + + + + + + + + + + This data element may be present either at 'Payment Information' or at 'Direct Debit Transaction Information' level. + + + + + + Only "SLEV" is allowed. + It is recommended that this element be specified at ‘Payment Information’ level. + + + + + + It is recommended that all transactions within the same ‘Payment Information’ block have the same ‘Creditor Scheme Identification’. + This data element must be present at either ‘Payment Information’ or ‘Direct Debit Transaction’ level. + + + + + + + + + + + + + + Payment Method 2Code + Specifies the transfer method that will be used to transfer the cash. + + + + + DirectDebit + Collection of an amount of money from the debtor's bank account by the creditor. The amount of money and dates of collections may vary. + + + + + + + Payment Type Information 29 + Provides further details of the type of payment. + + + + + Service Level + Agreement under which or rules under which the transaction should be processed. + + + + + Local Instrument + +User community specific instrument. + +Usage: This element is used to specify a local instrument, local clearing option and/or further qualify the service or service level. + + + + + + Sequence Type + Identifies the direct debit sequence, such as first, recurrent, final or one-off. + + + + + Category Purpose + +Specifies the high level purpose of the instruction based on a set of pre-defined categories. +Usage: This is used by the initiating party to provide information concerning the processing of the payment. It is likely to trigger special processing by any of the agents involved in the payment chain. + + + + + + + + + + + + + Mandatory. + Only one occurence is allowed. + + + + + + Mandatory. + + + + + + Mandatory. + AT-M006 The Transaction / Sequence Type. + If ‘Amendment Indicator’ is "true", and ‘Original Debtor Account’ is set to "SMNDA" (Same Mandate with a New Debtor Account), this message element indicates either "FRST", "RCUR", "FNAL" or "OOFF" (all four codes allowed, no restrictions). + + + + + + AT-T008 The Category purpose of the Collection. + Depending on the agreement between the Creditor and the Creditor PSP, ‘Category Purpose’ may be forwarded to the Debtor PSP. + + + + + + + + + + + + + + Mandatory. + Only one occurence is allowed. + + + + + + Mandatory. + + + + + + Mandatory. + AT-M006 The Transaction / Sequence Type. + If ‘Amendment Indicator’ is "true", and ‘Original Debtor Account’ is set to "SMNDA" (Same Mandate with a New Debtor Account), this message element indicates either "FRST", "RCUR", "FNAL" or "OOFF" (all four codes allowed, no restrictions). + + + + + + AT-T008 The Category purpose of the Collection. + Depending on the agreement between the Creditor and the Creditor PSP, ‘Category Purpose’ may be forwarded to the Debtor PSP. + + + + + + + + + Person Identification 13 + Unique and unambiguous way to identify a person. + + + + + Date And Place Of Birth + Date and place of birth of a person. + + + + + Other + Unique identification of a person, as assigned by an institution, using an identification scheme. + + + + + + + + + + + + + + + + + + + + + + Mandatory. + Only one occurrence of ‘Other’ is allowed, and no other sub-elements are allowed. + 'Identification' must be used with an identifier described in General Message Element Specifications, Chapter 1.5.2. + ‘Proprietary’ under ‘Scheme Name’ must specify "SEPA". + + + + + + + + + Person Identification Scheme Name 1Choice + Sets of elements to identify a name of the identification scheme. + + + + + Code + Name of the identification scheme, in a coded form as published in an external list. + + + + + Proprietary + Name of the identification scheme, in a free text form. + + + + + + + + + + + + + + + + + + + + + + Postal Address 24 + Information that locates and identifies a specific address, as defined by postal services. + + + + + Department + Identification of a division of a large organisation or building. + + + + + Sub Department + Identification of a sub-division of a large organisation or building. + + + + + Street Name + Name of a street or thoroughfare. + + + + + Building Number + Number that identifies the position of a building on a street. + + + + + Building Name + Name of the building or house. + + + + + Floor + Floor or storey within a building. + + + + + Post Box + Numbered box in a post office, assigned to a person or organisation, where letters are kept until called for. + + + + + Room + Building room number. + + + + + Post Code + Identifier consisting of a group of letters and/or numbers that is added to a postal address to assist the sorting of mail. + + + + + Town Name + Name of a built-up area, with defined boundaries, and a local government. + + + + + Town Location Name + Specific location name within the town. + + + + + District Name + Identifies a subdivision within a country sub-division. + + + + + Country Sub Division + Identifies a subdivision of a country such as state, region, county. + + + + + Country + Nation with its own government. + + + + + Address Line + Information that locates and identifies a specific address, as defined by postal services, presented in free format text. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only two occurrences are allowed. + If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. A combination of ‘Address Line’ and 'Country’ is allowed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only two occurrences are allowed. + +If ‘Address Line’ is used, then ‘Postal Address’ sub-elements other than ‘Country’ are forbidden. +A combination of ‘Address Line’ and 'Country’ is allowed; it is recommended when either Debtor Agent or Creditor Agent is a non-EEA SEPA PSP. + + + + + + + + + + Purpose 2Choice + +Specifies the underlying reason for the payment transaction. +Usage: Purpose is used by the end-customers, that is initiating party, (ultimate) debtor, (ultimate) creditor to provide information concerning the nature of the payment. Purpose is a content element, which is not used for processing by any of the agents involved in the payment chain. + + + + + + Code + Underlying reason for the payment transaction, as published in an external purpose code list. + + + + + + + + + + + + + + + + + + + + Remittance Information 16 + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system. + + + + + Unstructured + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in an unstructured form. + + + + + Structured + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in a structured form. + + + + + + + + + + + + ‘Unstructured’ may carry structured remittance information, as agreed between the Creditor and the Debtor. + Only one occurrence of ‘Unstructured’ is allowed. + If the commercial trade name of the payee is different from its legal name (AT-E001 The name of the Creditor), then the commercial trade name must be provided here. The location of where the transaction took place (if different from AT-E004 The address of the Creditor) as well as the transaction date and time can also be provided here. Each piece of information must be followed by a slash to clearly differentiate from the other information included under this data element (a special character other than a slash can be used instead (e.g., “+”) in case the slash is used for other purposes). [Example: The Shopping Paradise/Boulevard des Marchands 123/2020-12-24T11:37/Purchase Nr 1234567890AZ - Merry Christmas.] For further information, please refer to “EPC088-22 EPC Guidance Document – Improve Transparency for Retail Payment End-Users”. + + + + + + ‘Structured’ can be used, provided the tags and the data within the ‘Structured’ element do not exceed 140 characters in length. + Only one occurrence of ‘Structured’ is allowed. + + + + + + + + + Sequence Type 3Code + Specifies the type of the current transaction that belongs to a sequence of transactions. + + + + + Final + Final collection of a series of direct debit instructions. + + + + + First + First collection of a series of direct debit instructions. + + + + + OneOff + Direct debit instruction where the debtor's authorisation is used to initiate one single direct debit transaction. + + + + + Recurring + Direct debit instruction where the debtor's authorisation is used for regular direct debit transactions initiated by the creditor. + + + + + + + Service Level 8Choice + Specifies the service level of the transaction. + + + + + Code + Specifies a pre-agreed service or level of service between the parties, as published in an external service level code list. + + + + + + + + + + + + AT-T001 The identification code of the Scheme. + Only "SEPA" is allowed. + + + + + + + + + Structured Remittance Information 16 + Information supplied to enable the matching/reconciliation of an entry with the items that the payment is intended to settle, such as commercial invoices in an accounts' receivable system, in a structured form. + + + + + Creditor Reference Information + Reference information provided by the creditor to allow the identification of the underlying documents. + + + + + + + + + + + + When present, the Creditor PSP is not obliged to validate the reference information. + When used, both ‘Type’ and ‘Reference’ must be present. + + + + + + + + + True False Indicator + A flag indicating a True or False value. + + + + diff --git a/lib/sepa_king/message.rb b/lib/sepa_king/message.rb index 8e2b8cd..8f8f1ca 100644 --- a/lib/sepa_king/message.rb +++ b/lib/sepa_king/message.rb @@ -2,9 +2,11 @@ module SEPA PAIN_008_001_02 = 'pain.008.001.02' + PAIN_008_001_08 = 'pain.008.001.08' PAIN_008_002_02 = 'pain.008.002.02' PAIN_008_003_02 = 'pain.008.003.02' PAIN_001_001_03 = 'pain.001.001.03' + PAIN_001_001_09 = 'pain.001.001.09' PAIN_001_002_03 = 'pain.001.002.03' PAIN_001_003_03 = 'pain.001.003.03' PAIN_001_001_03_CH_02 = 'pain.001.001.03.ch.02' @@ -65,7 +67,7 @@ def schema_compatible?(schema_name) case schema_name when PAIN_001_002_03, PAIN_008_002_02 account.bic.present? && transactions.all? { |t| t.schema_compatible?(schema_name) } - when PAIN_001_001_03, PAIN_001_001_03_CH_02, PAIN_001_003_03, PAIN_008_003_02, PAIN_008_001_02 + when PAIN_001_001_03, PAIN_001_001_09, PAIN_001_001_03_CH_02, PAIN_001_003_03, PAIN_008_003_02, PAIN_008_001_02, PAIN_008_001_08 transactions.all? { |t| t.schema_compatible?(schema_name) } end end diff --git a/lib/sepa_king/message/credit_transfer.rb b/lib/sepa_king/message/credit_transfer.rb index 1153bfb..8841c05 100644 --- a/lib/sepa_king/message/credit_transfer.rb +++ b/lib/sepa_king/message/credit_transfer.rb @@ -5,7 +5,7 @@ class CreditTransfer < Message self.account_class = DebtorAccount self.transaction_class = CreditTransferTransaction self.xml_main_tag = 'CstmrCdtTrfInitn' - self.known_schemas = [ PAIN_001_001_03, PAIN_001_001_03_CH_02, PAIN_001_003_03, PAIN_001_002_03 ] + self.known_schemas = [ PAIN_001_001_03, PAIN_001_001_03_CH_02, PAIN_001_001_09, PAIN_001_003_03, PAIN_001_002_03 ] private # Find groups of transactions which share the same values of some attributes @@ -39,7 +39,13 @@ def build_payment_informations(builder, schema_name) end end end - builder.ReqdExctnDt(group[:requested_date].iso8601) + if schema_name == PAIN_001_001_09 + builder.ReqdExctnDt do + builder.Dt(group[:requested_date].iso8601) + end + else + builder.ReqdExctnDt(group[:requested_date].to_date.iso8601) + end builder.Dbtr do builder.Nm(account.name) end @@ -51,7 +57,11 @@ def build_payment_informations(builder, schema_name) builder.DbtrAgt do builder.FinInstnId do if account.bic - builder.BIC(account.bic) + if schema_name == PAIN_001_001_09 + builder.BICFI(account.bic) + else + builder.BIC(account.bic) + end elsif schema_name != PAIN_001_001_03_CH_02 builder.Othr do builder.Id('NOTPROVIDED') @@ -64,13 +74,13 @@ def build_payment_informations(builder, schema_name) end transactions.each do |transaction| - build_transaction(builder, transaction) + build_transaction(builder, transaction, schema_name) end end end end - def build_transaction(builder, transaction) + def build_transaction(builder, transaction, schema_name) builder.CdtTrfTxInf do builder.PmtId do if transaction.instruction.present? @@ -84,7 +94,11 @@ def build_transaction(builder, transaction) if transaction.bic builder.CdtrAgt do builder.FinInstnId do - builder.BIC(transaction.bic) + if schema_name == PAIN_001_001_09 + builder.BICFI(transaction.bic) + else + builder.BIC(transaction.bic) + end end end end diff --git a/lib/sepa_king/message/direct_debit.rb b/lib/sepa_king/message/direct_debit.rb index b643e13..a62c505 100644 --- a/lib/sepa_king/message/direct_debit.rb +++ b/lib/sepa_king/message/direct_debit.rb @@ -5,7 +5,7 @@ class DirectDebit < Message self.account_class = CreditorAccount self.transaction_class = DirectDebitTransaction self.xml_main_tag = 'CstmrDrctDbtInitn' - self.known_schemas = [ PAIN_008_001_02, PAIN_008_003_02, PAIN_008_002_02 ] + self.known_schemas = [ PAIN_008_001_02, PAIN_008_001_08, PAIN_008_003_02, PAIN_008_002_02 ] validate do |record| if record.transactions.map(&:local_instrument).uniq.size > 1 @@ -54,7 +54,11 @@ def build_payment_informations(builder, schema_name) builder.CdtrAgt do builder.FinInstnId do if group[:account].bic - builder.BIC(group[:account].bic) + if schema_name == PAIN_008_001_08 + builder.BICFI(account.bic) + else + builder.BIC(account.bic) + end else builder.Othr do builder.Id('NOTPROVIDED') @@ -77,7 +81,7 @@ def build_payment_informations(builder, schema_name) end transactions.each do |transaction| - build_transaction(builder, transaction) + build_transaction(builder, transaction, schema_name) end end end @@ -123,7 +127,7 @@ def build_amendment_informations(builder, transaction) end end - def build_transaction(builder, transaction) + def build_transaction(builder, transaction, schema_name) builder.DrctDbtTxInf do builder.PmtId do if transaction.instruction.present? @@ -142,7 +146,11 @@ def build_transaction(builder, transaction) builder.DbtrAgt do builder.FinInstnId do if transaction.bic - builder.BIC(transaction.bic) + if schema_name == PAIN_008_001_08 + builder.BICFI(transaction.bic) + else + builder.BIC(transaction.bic) + end else builder.Othr do builder.Id('NOTPROVIDED') diff --git a/lib/sepa_king/transaction/credit_transfer_transaction.rb b/lib/sepa_king/transaction/credit_transfer_transaction.rb index 8c031c2..a13cdcd 100644 --- a/lib/sepa_king/transaction/credit_transfer_transaction.rb +++ b/lib/sepa_king/transaction/credit_transfer_transaction.rb @@ -17,7 +17,7 @@ def initialize(attributes = {}) def schema_compatible?(schema_name) case schema_name - when PAIN_001_001_03 + when PAIN_001_001_03, PAIN_001_001_09 !self.service_level || (self.service_level == 'SEPA' && self.currency == 'EUR') when PAIN_001_002_03 self.bic.present? && self.service_level == 'SEPA' && self.currency == 'EUR' diff --git a/lib/sepa_king/transaction/direct_debit_transaction.rb b/lib/sepa_king/transaction/direct_debit_transaction.rb index 65b39ef..01cd08c 100644 --- a/lib/sepa_king/transaction/direct_debit_transaction.rb +++ b/lib/sepa_king/transaction/direct_debit_transaction.rb @@ -48,7 +48,7 @@ def schema_compatible?(schema_name) self.bic.present? && %w(CORE B2B).include?(self.local_instrument) && self.currency == 'EUR' when PAIN_008_003_02 self.currency == 'EUR' - when PAIN_008_001_02 + when PAIN_008_001_02, PAIN_008_001_08 true end end diff --git a/spec/credit_transfer_transaction_spec.rb b/spec/credit_transfer_transaction_spec.rb index 3fdd2e7..2104714 100644 --- a/spec/credit_transfer_transaction_spec.rb +++ b/spec/credit_transfer_transaction_spec.rb @@ -50,6 +50,13 @@ expect(SEPA::CreditTransferTransaction.new(:bic => 'SPUEDE2UXXX', :currency => 'CHF')).to be_schema_compatible('pain.001.001.03.ch.02') end end + + context 'for pain.001.001.09' do + it 'should succeed for valid attributes' do + expect(SEPA::CreditTransferTransaction.new(:bic => 'SPUEDE2UXXX', :currency => 'EUR')).to be_schema_compatible('pain.001.001.09') + expect(SEPA::CreditTransferTransaction.new(:bic => nil)).to be_schema_compatible('pain.001.001.09') + end + end end context 'Requested date' do diff --git a/spec/direct_debit_transaction_spec.rb b/spec/direct_debit_transaction_spec.rb index dc4d005..1011734 100644 --- a/spec/direct_debit_transaction_spec.rb +++ b/spec/direct_debit_transaction_spec.rb @@ -45,6 +45,12 @@ expect(SEPA::DirectDebitTransaction.new(:bic => 'SPUEDE2UXXX', :currency => 'CHF')).to be_schema_compatible('pain.008.001.02') end end + + context 'for pain.008.001.08' do + it 'should succeed for valid attributes' do + expect(SEPA::DirectDebitTransaction.new(:bic => 'SPUEDE2UXXX', :currency => 'EUR')).to be_schema_compatible('pain.008.001.08') + end + end end context 'Mandate Date of Signature' do