hoya/masterpass-bundle

Masterpass Bundle

Installs: 94

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:symfony-bundle

3.0.0 2018-07-02 12:06 UTC

This package is not auto-updated.

Last update: 2024-03-17 12:22:11 UTC


README

This Symfony 2 bundle implements the backend calls for Masterpass V7 checkout - Standard and Express flows. For complete Masterpass docs, refer https://developer.mastercard.com/product/masterpass

Build Status Total Downloads Latest Stable Version

Install

Add HoyaMasterpassBundle in your composer.json:

{
    "require": {
        "hoya/masterpass-bundle": "~3.0.0"
    }
}

Register the bundle in your appkernel.php file

return array(
   // ...
   new Hoya\MasterpassBundle\HoyaMasterpassBundle(),
   // ...
);

Setup your config.yml file

# app/config/config.yml

hoya_masterpass:
    production_mode: false
    checkoutidentifier: checkout_id
    keys:
        consumerkey: consumer_key_value
        keystorepath: "%kernel.root_dir%/cert/csr_file.p12"
        keystorepassword: changeit

Usage

You may follow some sample code here

Handling Errors

Any error which may happen while calling Masterpass APIs throws an Exception. Hence, it is highly recommended to use try / catch block In addition, you can check further details on symfony logs.

try {
                
    $payment = $this->get('hoya_masterpass_service')->getPaymentData($callback, '1234');

} catch (\Exception $e) {
    $this->get('session')->getFlashBag()->add('error', $e->getMessage());
}

Running the Tests

Install the Composer dev dependencies:

php composer.phar install --dev

Then, run the test suite using PHPUnit:

./phpunit