fabfuel/sephpa

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP library for creating SEPA XML documents for direct debit transactions

1.0.1 2014-01-04 10:02 UTC

This package is not auto-updated.

Last update: 2017-06-22 08:24:50 UTC


README

PHP library for creating SEPA XML documents for direct debit transactions.

Requiremens

  • Composer

Installation

  • Run `composer install` to install dependencies and generate the autoload.php

Usage

1. Create Configuration

First we have to define some variables and create a configuration instance:

With .ini config file:

Create a config file (e.g. `config/application.ini`) to define your company name, IBAN, BIC and creditor ID. You can use `config/_application.inias template. Create a config instance via\Sephpa\Config\ConfigIni('config/application.ini')`

Without config file:

Create a config instance via `\Sephpa\Config\ConfigInline($name, $iban, $bic, $creditorId)`

2. Create a file

Next we have to create a file instance which leads to an XML file in the end.

As defined in the ebics specifications [http://www.ebics.de] one file may contain several payments (with e.g. different due dates or sequence types like "first" or "recurring"), but some banks do not support that. You might have to create one separate file per payment, if you have transactions with e.g. different due dates or sequence types.

3. Create a payment

Next create a payment instance, define the sequence type and the due date and add the payment to the file.

4. Create transactions

The last step is creating one or more transactions and adding them to the corresponding payment.

In the Transaction you define the customers name, IBAN, BIC, his mandate reference and its sign date, the amount of the transaction, the subject (this is shown in the customers account statement) and a reference, which is used as the "End-to-End-Id" (which might also be visible for the customer).

5. Parse and save the XML-file

The last step is parsing/compiling the XML and saving it to a file.

See the Debit Example for a full example with one transaction.

Debit Example:

:::php
$configuration = new ConfigIni('config/application.ini');
$file = new File($configuration);

$payment = new PaymentDebit(
    $configuration,
    PaymentDebit::SEQUENCE_TYPE_FIRST,
    new DateTime('2013-12-20')
);
$file->addPayment($payment);

$debit = new Debit();
$debit
    ->setName('Customer #1')
    ->setIban('DE12123456781234567890')
    ->setBic('BANKDEXXXXX')
    ->setMandateReference('MANDATE')
    ->setMandateReferenceSignDate('2013-12-01')
    ->setAmount(35)
    ->setSubject('Order #12345')
    ->setReference('C123456');

$payment->addTransaction($debit);

$file->parse();
$file->save('debit.xml');`

Namespaces have been removed for this example. Find the full exmample in examples/debit.php