Skip to content

List transactions and load money into your Deutsche Post Portokasse using PHP

Notifications You must be signed in to change notification settings

XTAIN/deutschepost-portokasse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Client for Deutsche Post Portokasse

This package adds the missing functionality from Deutsche Post SOAP API to also load the Portokasse and to list the transactions.

Installation

The package is available via Composer. To install the latest version from Packagist, run:

composer require xtain/deutschepost-portokasse

Related packages

To generate stamps use the baltpeter/internetmarke-php package.

Example

<?php

require_once './vendor/autoload.php';

// Authenticate with same credentials as you login to https://portokasse.deutschepost.de/portokasse/
$portokasse = new \XTAIN\DeutschePostPortokasse\Client(
    '[email protected]',
    '******'
);

echo '####################################'.PHP_EOL;
echo '  => Current balance: ' . number_format($portokasse->getBalance() / 100, 2, ',', '.'). ''.PHP_EOL;
echo '####################################'.PHP_EOL;
echo PHP_EOL;
echo '##### Transactions #####'.PHP_EOL;

foreach ($portokasse->getJournal() as $journal) {
    /** @var \XTAIN\DeutschePostPortokasse\Model\JournalEntry $entry */
    foreach ($journal as $entry) {
        echo ' Date:            ' . $entry->getDate()->format(\DateTime::W3C) . PHP_EOL;
        echo ' Amount:          ' .  number_format($entry->getAmount() / 100, 2, ',', '.'). ''.PHP_EOL;
        echo ' Accounting Text: ' . $entry->getAccountingText() . PHP_EOL;
        echo ' Channel:         ' . $entry->getChannel() . PHP_EOL;
        echo ' Shop Order ID:   ' . $entry->getShopOrderId() . PHP_EOL;
        echo ' State:           ' . $entry->getState() . PHP_EOL;
        echo ' Type:            ' . $entry->getType() . PHP_EOL;
        echo '=============================='.PHP_EOL;
    }
}

/*
try {
    // load 1€ cent by SEPA direct debit
    $portokasse->loadMoneyDirectDebit(1);
} catch (\XTAIN\DeutschePostPortokasse\Exception\InvalidPaymentAmountException $e) {
    // increase amount
}
*/

About

List transactions and load money into your Deutsche Post Portokasse using PHP

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages