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
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
You may follow some sample code here
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());
}
Install the Composer dev
dependencies:
php composer.phar install --dev
Then, run the test suite using PHPUnit:
./phpunit