Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example script to version stable ^2.0 #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions example/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
use AbcAeffchen\SepaUtilities\SepaUtilities;
use AbcAeffchen\Sephpa\SephpaDirectDebit;

require_once '../src/Sephpa.php';
chdir(dirname(__DIR__));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to be unnecessary.

require __DIR__ . '/../vendor/autoload.php';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vendor folder is not part of the repository. There should be a note, that is requires composer. Additionally a comment with instructions to use this without composer would be nice. This is basically using src/autoloader.php and SepaUtilities.php that needs to be downloaded separately.


$collectionData = [
// needed information about the payer
Expand All @@ -36,11 +37,13 @@

// generate a SepaCreditTransfer object (pain.001.002.03).
$creditTransferFile = new SephpaCreditTransfer('Initiator Name', 'MessageID-1234',
SephpaCreditTransfer::SEPA_PAIN_001_003_03,
$collectionData);
SephpaCreditTransfer::SEPA_PAIN_001_003_03);

// generate and add SephpaCreditTransfer* collection object
$creditTransferCollection = $creditTransferFile->addCollection($collectionData);

// at least one in every CreditTransferCollection
$creditTransferFile->addPayment([
$creditTransferCollection->addPayment([
// needed information about the one who gets payed
'pmtId' => 'TransferID-1234-1', // ID of the payment (EndToEndId)
'instdAmt' => 1.14, // amount,
Expand Down Expand Up @@ -74,13 +77,15 @@
];

$directDebitFile = new SephpaDirectDebit('Initiator Name', 'MessageID-1235',
SephpaDirectDebit::SEPA_PAIN_008_003_02,
$collectionData);
SephpaDirectDebit::SEPA_PAIN_008_003_02);

// at least one in every SEPA file. No limit.

// generate and add SephpaDirectDebit* collection object
$directDebitCollection = $directDebitFile->addCollection($collectionData);

// at least one in every DirectDebitCollection. No limit.
$directDebitFile->addPayment([
$directDebitCollection->addPayment([
// needed information about the
'pmtId' => 'TransferID-1235-1', // ID of the payment (EndToEndId)
'instdAmt' => 2.34, // amount
Expand Down