2017 © Pedro Peláez
 

library satispay-php-sdk

PHP SDK for Satispay API

image

chiarillomassimo/satispay-php-sdk

PHP SDK for Satispay API

  • Sunday, August 20, 2017
  • by ChiarilloMassimo
  • Repository
  • 1 Watchers
  • 2 Stars
  • 300 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 4 Versions
  • 6 % Grown

The README.md

SensioLabsInsight, (*1)

Satispay PHP SDK

  • [X] Check Bearer
  • [X] Users
  • [X] Charges
  • [ ] Daily closure (@WIP)
  • [X] Refunds

Install

Download composer, (*2)

$ composer require chiarillomassimo/satispay-php-sdk

API: Init

use ChiarilloMassimo\Satispay\Authorization\Bearer;
use ChiarilloMassimo\Satispay\Satispay;

$satispay = new Satispay(
    new Bearer('osh_...'),
    'sandbox'
);

API: Check Bearer

Check Authorization

if ($satispay->getBearerHandler()->isAuthorized()) {
 ....
};

API: Users

Creation

$satispay->getUserHandler()->createByPhoneNumber('+39 yourphone')

$user = new User(null, '+39 yourphone');
$satispay->getUserHandler()->persist($user)

Get

$satispay->getUserHandler()->findOneById('id')

Find

$satispay->getUserHandler()->find()
$satispay->getUserHandler()->find(50, 'starting_id', 'ending_id')

$users = $satispay->getUserHandler()->find();

foreach ($users as $user) {
    //...
}

API: Charge

Create

use ChiarilloMassimo\Satispay\Model\Charge;

$charge = new Charge();

$user = $satispay->getUserHandler()->createByPhoneNumber('+39 yourphone');

$charge
    ->setUser($user)
    ->setAmount(15) // 0.15 €
    ->setCallbackUrl('http://fakeurl.com/satispay-callback')
    ->setCurrency('EUR')
    ->setDescription('Test description')
    ->setExpireMinutes(20)
    ->setExtraFields([
        'orderId' => 'id',
        'extra' => 'extra'
    ])
    ->setSendMail(false);

$satispay->getChargeHandler()->persist($charge, true);

$charge->isPaid(); //false
$charge->getStatus(); //Charge::STATUS_REQUIRED

Get

$satispay->getChargeHandler()->findOneById('charge_id')

Update

$charge = $satispay->getChargeHandler()->findOneById('charge_id')
$charge->setDescription('My fantastic description!!')

$satispay->getChargeHandler()->update($charge)

Find

$satispay->getChargeHandler()->find()
$satispay->getChargeHandler()->find(50, 'starting_id', 'ending_id')

$charges = $satispay->getChargeHandler()->find();

foreach ($charges as $charge) {
    //...
}

API: Daily closure

This feature is in pending, (*3)

$amount = $satispay->getDailyClosureHandler()->getAmount(new \DateTime('2017/01/01'));

API: Refund

Creation

use \ChiarilloMassimo\Satispay\Model\Refund;

$charge = $satispay->getChargeHandler()->findOneById('id');

$refund = new Refund();
$refund
    ->setCharge($charge)
    ->setDescription('Test')
    ->setAmount(15)
    ->setReason(Refund::DUPLICATE);

$satispay->getRefundHandler()->persist($refund);

Get

$satispay->getRefundHandler()->findOneById('id'));

Update

$refund = $satispay->getRefundHandler()->findOneById('id');
$refund->setDescription('My fantastic description!!');

$satispay->getRefundHandler()->update($refund);

Find

$satispay->getRefundHandler()->find()
$satispay->getRefundHandler()->find(50, 'starting_id', 'ending_id')

$refunds = $satispay->getRefundHandler()->find();

foreach ($refunds as $refund) {
    //...
}

The Versions

20/08 2017

dev-master

9999999-dev

PHP SDK for Satispay API

  Sources   Download

MIT

The Requires

 

18/08 2017

v0.1.1

0.1.1.0

PHP SDK for Satispay API

  Sources   Download

MIT

The Requires

 

14/01 2017

v0.1

0.1.0.0

PHP SDK for Satispay API

  Sources   Download

MIT

The Requires

 

14/01 2017

dev-dev

dev-dev

PHP SDK for Satispay API

  Sources   Download

MIT

The Requires