2017 © Pedro Peláez
 

symfony-bundle masterpass-bundle

Masterpass Bundle

image

hoya/masterpass-bundle

Masterpass Bundle

  • Monday, July 2, 2018
  • by marcoshoya
  • Repository
  • 1 Watchers
  • 0 Stars
  • 48 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

MasterpassBundle

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, (*1)

Build Status Total Downloads Latest Stable Version, (*2)

Install

Add HoyaMasterpassBundle in your composer.json:, (*3)

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

Register the bundle in your appkernel.php file, (*4)

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

Setup your config.yml file, (*5)

# 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, (*6)

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., (*7)

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:, (*8)

php composer.phar install --dev

Then, run the test suite using PHPUnit:, (*9)

./phpunit

The Versions