troopers / mangopay-bundle
This Bundle include Mangopay php sdk as a service
Installs: 17 817
Dependents: 0
Suggesters: 0
Security: 0
Stars: 27
Watchers: 13
Forks: 19
Open Issues: 4
Type:symfony-bundle
Requires
- php: ~5.5|~7
- mangopay/php-sdk-v2: >=2.0
- stof/doctrine-extensions-bundle: ~1.2
- symfony/framework-bundle: ~3.4|~4
- troopers/ajax-bundle: ~1.2
README
MangopayBundle
Description
This bundle provides integration of the official SDK PHP for Mangopay api V2 into Symfony.
- This branch does support the v2.01 API version.
- The v1 branch does support the v2 API version.
Configuration
troopers_mangopay: client_id: your_mangopay_client_id client_password: your_mangopay_client_password base_url: your_mangopay_base_url
How to use it ?
The official sdk provides a "MangoMapApi" class which is a shortcut to all the "tools" like "ApiPayIns", "ApiWallets", "ApiUsers"... You can access those "tools" through the service "troopers_mangopay.mango_api".
$payIn = new PayIn(); $this->get('troopers_mangopay.mango_api')->PayIns->create($payIn);
Helpers
Additionnaly, there is some helpers that handle most of the mangopay actions. Feel free to fork and implement yours.
BankInformationHelper
It can register user BankInformations as it implements BankInformationInterface
$bankInformation = new BankInformation(); $this->get('troopers_mangopay.bank_information_helper')->createBankAccount($bankInformation);
PaymentHelper
It can register a CardPreauthorisation and execute it
$cardRegistration = new CardRegistration(); $this->get('troopers_mangopay.payment_helper')->createPreAuthorisation($cardRegistration); $cardPreAuthorisation = new CardPreAuthorisation(); $this->get('troopers_mangopay.payment_helper')->executePreAuthorisation($cardPreAuthorisation, $user, $wallet);
PaymentDirectHelper
It can create a new direct payment
$transaction = new Transaction(); $this->get('troopers_mangopay.payment_direct_helper')->createDirectTransaction($transaction);
UserHelper
It can create a new user in mangopay as the User object implements the UserInterface
$user = new User(); $this->get('troopers_mangopay.user_helper')->createMangoUser($user);
WalletHelper
It can create a user wallet
$user = new User(); $this->get('troopers_mangopay.wallet_helper')->createWalletForUser($user);
General workflow
This is the general workflow for the mangopay payment page:
- Displaying the payment form to user
- Create mangopay user and the card registration through mangopay API