Skip to content

Atos Sips driver for the Omnipay payment processing library

Notifications You must be signed in to change notification settings

ambroisemaupate/omnipay-sips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Omnipay gateway for Atos SIPS

Forked from cleverage/omnipay pull request.

Usage

Every calls to SIPS binary may throw a SipsBinaryException if shell exec is mis-configured (-1 return code). However, an accepted or refused payment should return a 0 code from SIPS binary. That’s why isSuccessful method does not care about binary return code but responseCode.

1. Generating a credit card form

Before being redirected to bank website, we must generate a credit-card form using SIPS binary and gateway purchase method.

$gateway = \Omnipay\Omnipay::create('Sips');
$gateway->setMerchantId('XXXXXXXXXXXXXXXXX');
$gateway->setSipsFolderPath('/path/to/sogenactif');

$card = new \Omnipay\Sips\OffsiteCreditCard();
$card->setEmail('[email protected]');

// Send purchase request
$request = $gateway->purchase(
    [
        'clientIp' => $request->getClientIp(),
        'amount' => '10.00',
        'currency' => 'EUR',
        'returnUrl' => $this->generateUrl('completePurchaseRoute', [], UrlGenerator::ABSOLUTE_URL),
        'notifyUrl' => $this->generateUrl('completePurchaseRoute', [], UrlGenerator::ABSOLUTE_URL),
        'cancelUrl' => $this->generateUrl('cancelRoute', [], UrlGenerator::ABSOLUTE_URL),
        'card' => $card
    ]
);
$response = $request->send();

if ($response->isSuccessful()) {
    echo $response->getBuffer();
} else {
    echo $response->getMessage();
}

2. Receiving bank notification

After customer filled up his credit card informations on bank website, a POST request will be send with a DATA content. This must be decoded using SIPS binary and completePurchase gateway method.

// Send completePurchase request
$request = $gateway->completePurchase(
    [
        'sipsData' => $request->request->get('DATA'),
    ]
);
$response = $request->send();

if ($response->isSuccessful()) {
    echo $response->getTransactionId();
} else {
    echo $response->getMessage();
}

Test credit card numbers

Number Response
4974934125497800 00 (accepted)
4972187615205 05 (refused)

About

Atos Sips driver for the Omnipay payment processing library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages