Last active
August 29, 2015 13:57
-
-
Save iannsp/9840920 to your computer and use it in GitHub Desktop.
A study/usage case for Ecomz\Payment Bundle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config = new Config(); | |
// empty configuration just for example | |
$config->fromArray(array()); | |
$payment = new Payment($config); | |
/* this is a BankBillet payment Operation using the Supported Service Provider named PaymentProvider. The obligatory data are the UPPERCASE ONE's. | |
always need a client identifier, so CLIENTID | |
always need a Service Provider, so PROVIDER (initial configuration can provide a default provider) | |
always need a Service Provider Method for perform the payment, so METHOD (example: BankBillet, CreditCard, DebitCard) | |
*/ | |
$operation = array( | |
'PROVIDER'=>'PaymentProvider', | |
'METHOD'=>'Boleto', | |
'value'=>150.00, | |
'duedate'=>'2014-05-13', | |
'CLIENTID'=>4250, | |
'TRANSACTIONID'=>42424242 | |
); | |
$operationDescriptor = new Container(); | |
$operationDescriptor->fromArray($operation); | |
try{ | |
// exceptions can be: Method not supported, Provider not supported, Perform Failure | |
$response = $payment->request($operationDescriptor); | |
}catch(\Ecomz\Payment\Exception $E){ | |
$myPersistentService = new PersistentService(); | |
$myPersistentService->paymentResponse($response); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment