Skip to content

Library for exporting payment orders (pain) using the iso20022 format

License

Notifications You must be signed in to change notification settings

AyazKhuraishi/iso20022

 
 

Repository files navigation

iso20022

This library can be used for exporting payment orders (pain001 files) using the iso20022 format for Switzerland.

Getting Started

These instructions will get you an overview on how to implement and use the iso20022 library. See further down for installing or deployment notes.

Installing

<dependency>
    <groupId>ch.dvbern.oss.iso20022</groupId>
    <artifactId>iso20022-impl</artifactId>
    <version>(NEWEST_VERSION)</version>
</dependency>

Usage Example

public class MyCDIEnabledClass {

    @Inject
    private Pain001Service pain001Service;
    
    private static final String STORE_PATH = "target/painDemoFile.xml";
    
    public void createDemoPainFile() {
        Pain001DTO pain001DTO = demoPaymentOrder();
        final byte[] painFileContent = pain001Service.getPainFileContent(pain001DTO);
        writeResultsToFile(painFileContent);
    }
        
    private Pain001DTO demoPaymentOrder() {
        Pain001DTO pain001DTO = new Pain001DTO();
            
        pain001DTO.setAuszahlungsDatum(LocalDate.now());
        pain001DTO.setGenerierungsDatum(LocalDateTime.now());            
        pain001DTO.setSchuldnerName("John Deptor");
        pain001DTO.setSchuldnerIBAN("CH9300762011623852957");
        pain001DTO.setSchuldnerBIC("POFICHBEXXX");
        pain001DTO.setSoftwareName("DVBern Payment Tool");
        pain001DTO.setMsgId("Test-ID");
            
        List<AuszahlungDTO> payments = new ArrayList<>();

        // first paying out
        AuszahlungDTO payment1 = new AuszahlungDTO();
        payment1.setBetragTotalZahlung(BigDecimal.TEN);
        payment1.setZahlungsempfaegerBankClearingNumber("POFICHBEXXX");
        payment1.setZahlungsempfaegerIBAN("CH9300762011623852957");
        payment1.setZahlungsempfaegerLand("CH");
        payment1.setZahlungsempfaegerName("Hans Payee");
        payment1.setZahlungsempfaegerStrasse("Teststreet");
        payment1.setZahlungsempfaegerHausnummer("1");
        payment1.setZahlungsempfaegerPlz("3000");
        payment1.setZahlungsempfaegerOrt("Bern");
        payment1.setZahlungText("This is my first payment");
        payments.add(payment1);

        // second paying out
        AuszahlungDTO payment2 = new AuszahlungDTO();
        payment2.setBetragTotalZahlung(new BigDecimal(1000));
        payment2.setZahlungsempfaegerBankClearingNumber("POFICHBEXXX");
        payment2.setZahlungsempfaegerIBAN("CH9300762011623852957");
        payment2.setZahlungsempfaegerLand("CH");
        payment2.setZahlungsempfaegerName("Kurt Payee");
        payment2.setZahlungsempfaegerStrasse("Teststreet");
        payment2.setZahlungsempfaegerHausnummer("2");
        payment2.setZahlungsempfaegerPlz("4000");
        payment2.setZahlungsempfaegerOrt("Zürich");
        payment1.setZahlungText("This is my second payment");
        payments.add(payment2);
        
        pain001DTO.setAuszahlungen(payments);
        
        return pain001DTO;        
    }
        
    /**
     * Write data to File
    */
    private void writeResultsToFile(byte[] data) throws IOException {
        FileOutputStream fos = new FileOutputStream(STORE_PATH);
        fos.write(data);
        fos.close();
    }
}
    

Built With

  • Maven - Dependency Management

Contributing Guidelines

Please read CONTRIBUTING.md for the process for submitting pull requests to us.

Code of Conduct

One healthy social atmospehere is very important to us, wherefore we rate our Code of Conduct high. For details check the file CODE_OF_CONDUCT.md

Authors

  • DV Bern AG - Initial work - dvbern

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.

About

Library for exporting payment orders (pain) using the iso20022 format

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%