2017 © Pedro Peláez
 

library easytransac-sdk-php

image

easytransac/easytransac-sdk-php

  • Sunday, March 4, 2018
  • by easytransac
  • Repository
  • 1 Watchers
  • 0 Stars
  • 119 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 15 Versions
  • 11 % Grown

The README.md

EasyTransac SDK (PHP)

Build PSR12 Test Coverage Status Latest Stable Version, (*1)

Make your EasyTransac API implementation easier with our SDK., (*2)

The EasyTransac SDK is a tool to process payments with the EasyTransac API., (*3)

Requirements

You need at least: - PHP >=5.6 - cURL in order to get clear error messages - An API key provided by EasyTransac (register an account at EasyTransac website) - OpenSSL version 1.0.1 to support TLSv1.2 ciphers, (*4)

Installation

By composer

Execute this command on your terminal in the project folder:, (*5)

composer require easytransac/easytransac-sdk-php

Or add this in your composer.json:, (*6)

"require": {
  ...
  "easytransac/easytransac-sdk-php": "*",
}

Manually

In order to use it, you only need to require the autoload file easytransac/easytransac-sdk-php/sdk/EasyTransac/autoload.php., (*7)

Unit Testing

Our test cases are written under PHPUnit 4.4.1, also if you want to launch tests, please check your PHPUnit version for methods compatibility., (*8)

Samples

Samples are provided with the SDK., (*9)

Set up the configuration

// Don't forget to require the composer autoload or sdk's
require_once(__DIR__.'/vendor/easytransac/easytransac-sdk-php/sdk/EasyTransac/autoload.php');

// Provide the API key
EasyTransac\Core\Services::getInstance()->provideAPIKey('YOUR_API_KEY_HERE');

// For testing, you can activate logs
EasyTransac\Core\Services::getInstance()->setDebug(true);

// Connexion timeout in second
EasyTransac\Core\Services::getInstance()->setRequestTimeout(30);

// You can change the log directory (by default the path is the running script path)
Logger::getInstance()->setFilePath('YOU_CUSTOM_PATH');

Make a direct payment request

$customer = (new EasyTransac\Entities\Customer())
    ->setFirstname('Demo')
    ->setLastname('Mini SDK')
    ->setCity('Strasbourg')
    ->setUid('a1b2c3d4');

$card = (new EasyTransac\Entities\CreditCard())
    ->setNumber('1111111111111111')
    ->setMonth('10')
    ->setYear('2017')
    ->setCVV('123');

$transaction = (new EasyTransac\Entities\DirectTransaction())
    ->setAmount(100)
    ->setClientIp('127.0.0.1')
    ->setCustomer($customer)
    ->setCreditCard($card);

$dp = new EasyTransac\Requests\DirectPayment();
$response = $dp->execute($transaction);

if ($response->isSuccess())
{
    $transactionItem = $response->getContent();

    // Check if the 3DSecure is forced by the server on this transaction,
    // if yes, then we must use the 3DS url to finish the transaction
    if ($transactionItem->getSecure())
    {
        // Using of the 3DS url
        // You have to call this url to proceed the 3DS process
        // $transactionItem->getSecureUrl();

    }
    else
    {
        // Shows the transaction status and id      
        var_dump($transactionItem->getStatus());
        var_dump($transactionItem->getTid());
    }
}
else
{
    var_dump($response->getErrorMessage());
}

Push payment notification

// EasyTransac notifies you for the payment status
// Then in your website, you have to create a script to receive the notification
$response = \EasyTransac\Core\PaymentNotification::getContent($_POST, $myApiKey);

// Response of type \EasyTransac\Entities\Notification
var_dump($response->toArray());

// Payment status
var_dump($response->getStatus());

// If you have a doubt about a value that does not exist in the response, 
// you can print the superglobal $_POST, all notification values are there:
var_dump($_POST);

Get base API response in JSON and Array

// You can get the complete response from the api with these methods bellow
$dp = new EasyTransac\Requests\DirectPayment();
$response = $dp->execute($transaction);

var_dump($response->getRealJsonResponse()); // Jsonified response (stdClass object)
var_dump($response->getRealArrayResponse()); // Array item

The Versions

04/03 2018

V1.0

1.0.0.0

  Sources   Download

12/02 2018

dev-master

9999999-dev

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

12/02 2018

1.0.11

1.0.11.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

10/11 2017

1.0.10

1.0.10.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

06/09 2017

1.0.9

1.0.9.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

17/02 2017

1.0.8

1.0.8.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

30/01 2017

1.0.7

1.0.7.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

19/01 2017

1.0.6

1.0.6.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

19/01 2017

1.0.5

1.0.5.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

18/01 2017

1.0.4

1.0.4.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.5

 

05/01 2017

dev-Development

dev-Development

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.4

 

03/01 2017

1.0.3

1.0.3.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.4

 

03/01 2017

1.0.0

1.0.0.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.4

 

03/01 2017

1.0.2

1.0.2.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.4

 

03/01 2017

1.0.1

1.0.1.0

A SDK to make payment with the EasyTransac API

  Sources   Download

The Requires

  • php >=5.4