Openbravo Issue Tracking System - Modules
View Issue Details
0036217ModulesSEPA Framework and Utilitiespublic2017-06-09 09:552017-06-21 15:07
vmromanos 
markmm82 
normalmajorN/A
closedfixed 
5
 
 
aferraz
No
0036217: Add hooks in SEPA so XML file can be modified by external modules
Add necessary hooks to allow SEPA XML files to be modified by external modules.
These hooks should allow to easily develop customizations required by concrete countries or banks without affecting the original module.
NA
No tags attached.
related to feature request 0031234 closed aferraz It would be nice to include not mandatory "NbOfTxs" and "CtrlSum" tags inside "PmtInf" 
Issue History
2017-06-09 09:55vmromanosNew Issue
2017-06-09 09:55vmromanosAssigned To => Triage Finance
2017-06-09 09:55vmromanosOBNetwork customer => No
2017-06-09 09:55vmromanosRelationship addedrelated to 0031234
2017-06-09 16:49markmm82Assigned ToTriage Finance => markmm82
2017-06-09 16:49markmm82Statusnew => acknowledged
2017-06-12 16:22markmm82Statusacknowledged => scheduled
2017-06-19 18:13markmm82Note Added: 0097489
2017-06-20 18:38hgbotCheckin
2017-06-20 18:38hgbotNote Added: 0097534
2017-06-20 18:38hgbotStatusscheduled => resolved
2017-06-20 18:38hgbotResolutionopen => fixed
2017-06-20 18:38hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.sepa.iso20022/rev/6a2a1981284cb9d160ba327688b38aae77c7d17b [^]
2017-06-20 18:39hgbotCheckin
2017-06-20 18:39hgbotNote Added: 0097535
2017-06-21 15:03hgbotCheckin
2017-06-21 15:03hgbotNote Added: 0097558
2017-06-21 15:07aferrazReview Assigned To => aferraz
2017-06-21 15:07aferrazNote Added: 0097559
2017-06-21 15:07aferrazStatusresolved => closed

Notes
(0097489)
markmm82   
2017-06-19 18:13   
Test Plan 1:
Install and configure Remittance Infrastructure module. You can follow directions in link bellow:
  http://wiki.openbravo.com/wiki/Projects/Remittances/Configuration_Manual [^]
  http://wiki.openbravo.com/wiki/Projects/Remittances/User_Documentation [^]
Install and configure SEPA Credit Transfer and SEPA Direct Debit modules:
  http://wiki.openbravo.com/wiki/SEPA_Credit_Transfer_Customer-to-Bank/User_Documentation [^]
  http://wiki.openbravo.com/wiki/SEPA_Direct_Debit_Customer-to-Bank/User_Documentation [^]
Be sure to add IBAN/SWIFT code to used business partners.

Test case 1: Without installing the external module and without executing any hook
  Create any payment out, purchase order or purchase invoice document, to later be included into the remittance.
  Create a Remittance header.
    Remittance Type: SEPA Credit Transfer Customer-to-Bank (pain.001.001.03)
  Add previously created order, invoice and/or payment by Select Payments or Select Orders or Invoices buttons.
  Proccess the remittance.
  Create Remittance File.
    Notice in the <GrpHdr>
 node you will find <NbOfTxs> and <CtrlSum> tags, for example something like this:
    <GrpHdr>
    
    ...
        <NbOfTxs>3</NbOfTxs>
            
        <CtrlSum>200050.00</CtrlSum>
    ...
    </GrpHdr>

    Notice inside the <PmtInf> nodes, there aren't any of <NbOfTxs> and <CtrlSum> tags, it is right because this tags are optionals inside this node.

Repeat all steps but using Remittance Type = SEPA Credit Transfer Customer-to-Bank (pain.001.001.04).
Repeat all steps but using Remittance Type = SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02).
Repeat all steps but using Remittance Type = SEPA Core Direct Debit Customer-to-Bank (pain.008.001.03).
    Notice for all the cases that the <PmtInf> nodes, haven't any of <NbOfTxs> and <CtrlSum> tags.


Test case 2: Installing the external module and executing hooks to modify XML file
  Install SEPA-Remittance Extensions module (org.openbravo.sepa.iso20022.extensions)
  Apply module dataset.
  Go to Remittance Type and check there are new params (PmtInf_CtrlSum and PmtInf_NbOfTxs) defined to the remittance types:
    SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02)
    SEPA Core Direct Debit Customer-to-Bank (pain.008.001.03)
    SEPA Credit Transfer Customer-to-Bank (pain.001.001.03)
    SEPA Credit Transfer Customer-to-Bank (pain.001.001.04)
  Select SEPA Credit Transfer Customer-to-Bank (pain.001.001.03) remittance type.
  Go to Parameters tab and change values of PmtInf_CtrlSum and PmtInf_NbOfTxs to Y, to be able to add this nodes at the generated Payment info of each record included in the XML file.
  Create any payment out, purchase order or purchase invoice document, to later be included into the remittance.
  Create a Remittance header.
    Remittance Type: SEPA Credit Transfer Customer-to-Bank (pain.001.001.03)
  Add previously created order, invoice and/or payment by Select Payments or Select Orders or Invoices buttons.
  Proccess the remittance.
  Create Remittance File.
  Notice in the <GrpHdr>
 node you will find <NbOfTxs> and <CtrlSum> tags, for example something like this:
    <GrpHdr>
    
    ...
        <NbOfTxs>3</NbOfTxs>
            
        <CtrlSum>200050.00</CtrlSum>
    ...
    </GrpHdr>

    Notice inside the <PmtInf> nodes, you will find <NbOfTxs> and <CtrlSum> tags too with more precisely information of the selected payment, for example something like this:
    <PmtInf>
            
        <PmtInfId>1000000-2017-06-13</PmtInfId>
            
        <PmtMtd>TRF</PmtMtd>
           
        <NbOfTxs>1</NbOfTxs>
            
        <CtrlSum>108900.00</CtrlSum>

Repeat all steps but using Remittance Type = SEPA Credit Transfer Customer-to-Bank (pain.001.001.04).
Repeat all steps but using Remittance Type = SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02).
Repeat all steps but using Remittance Type = SEPA Core Direct Debit Customer-to-Bank (pain.008.001.03).
    Notice for all cases that <NbOfTxs> and <CtrlSum> tags are present inside the <PmtInf>
.


Test case 3:
  Repeat test case 2 but only put the PmtInf_NbOfTxs parameter's value to Y.
  Notice when you generate the XML file only this tag is added to <PmtInf>, the <CtrlSum> tag it is not added.


Test case 4: Error management
  When the executed hook throws exceptions, the process show a popup message explaining that to the user:
    "org.openbravo.base.exception.OBException: Error while executing the SEPA hook <Error message>".
  To test it you can modify the SEPA_RemittanceHook.java of SEPA-Remittance Extensions module (org.openbravo.sepa.iso20022.extensions/hook) to simulate an exception when executing the hook, for instance you can modify the exec() method with something like this:
@ApplicationScoped
public class SEPA_RemittanceHook implements SEPA_RemittanceProcessHook {
  private static final String PARAM_PMTINF_CTRLSUM = "PmtInf_CtrlSum";
  private static final String PARAM_PMTINF_NBOFTXS = "PmtInf_NbOfTxs";

  @Override
  public <T> void exec(Remittance remittance, JAXBElement<T> doc) throws Exception {
    if (doc.getValue() != null){
      throw new OBException("error");
    }
    ...

  Create any payment out, purchase order or purchase invoice document, to later be included into the remittance.
  Create a Remittance header.
    Remittance Type: SEPA Credit Transfer Customer-to-Bank (pain.001.001.03)
  Add previously created order, invoice and/or payment by Select Payments or Select Orders or Invoices buttons.
  Proccess the remittance.
  Create Remittance File.
  Notice this time the XML file it is not generated but an error message is shown:
    "org.openbravo.base.exception.OBException: Error while executing the SEPA hook org.openbravo.base.exception.OBException: error"
(0097534)
hgbot   
2017-06-20 18:38   
Repository: erp/pmods/org.openbravo.sepa.iso20022
Changeset: 6a2a1981284cb9d160ba327688b38aae77c7d17b
Author: Mark <markmm82 <at> gmail.com>
Date: Fri Jun 16 11:40:14 2017 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.sepa.iso20022/rev/6a2a1981284cb9d160ba327688b38aae77c7d17b [^]

Fixes issue 36217: Add hooks in SEPA so XML can be modified by external modules

Add the possibility of include hooks in SEPA Infrastructure module. This way
generated XML file can be modified by external modules. This new behaviour was included
inside SEPA_RemittanceCreateFile file before calling generateSEPAXML method.

Also was created a new SEPA_RemittanceProcessHook interface, hooks will implement
it to extend the SEPA functionality.

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/sepa/iso20022/util/SEPA_RemittanceCreateFile.java
A src/org/openbravo/sepa/iso20022/util/SEPA_RemittanceHookCaller.java
A src/org/openbravo/sepa/iso20022/util/SEPA_RemittanceProcessHook.java
---
(0097535)
hgbot   
2017-06-20 18:39   
Repository: erp/pmods/org.openbravo.sepa.iso20022
Changeset: 28351df5439a9da0f6dc7fb59671c13e1a18fabe
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Jun 20 18:38:00 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.sepa.iso20022/rev/28351df5439a9da0f6dc7fb59671c13e1a18fabe [^]

Related to issue 36217: Fix copyrights and typos

---
M src/org/openbravo/sepa/iso20022/util/SEPA_RemittanceHookCaller.java
M src/org/openbravo/sepa/iso20022/util/SEPA_RemittanceProcessHook.java
---
(0097558)
hgbot   
2017-06-21 15:03   
Repository: erp/pmods/org.openbravo.sepa.iso20022
Changeset: 6e0368b2382b5089ac5e1b63d80a4661ab6718b6
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Jun 21 15:02:31 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.sepa.iso20022/rev/6e0368b2382b5089ac5e1b63d80a4661ab6718b6 [^]

Related to issue 36217: Update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
---
(0097559)
aferraz   
2017-06-21 15:07   
Code review + Testing OK