dev-master
9999999-devA set of Symfony services for use in your project in integrate with MangoPay API faster.
MIT
The Requires
The Development Requires
by Carl Owens
by Graham Owens
by PartFire Ltd
A set of Symfony services for use in your project in integrate with MangoPay API faster.
A set of Symfony services for use in your project to ease integration with Mangopay API., (*2)
This bundle depends upon the official Mangopay SDK PHP for Mangopay API v2. This means that this bundle only supports Mangopay API version v2.01 but not the earlier versions. Please check which version you are using., (*3)
Using composer you can simply require master for now until we have a stable release:, (*4)
$ composer require partfire/mangopay-bundle:dev-master
Add your details to your app/config/parameters.yml
file. For example:, (*5)
mangopay_client_id: my_mango_id mangopay_client_password: XXXXXXXXXXXXXXXXXXXXXX mangopay_base_url: 'https://api.sandbox.mangopay.com'
Also add to your app/AppKernel.php
file:, (*6)
new PartFire\MangoPayBundle\PartFireMangoPayBundle()
$userService = $this->container->get('part_fire_mango_pay.services.user'); $userDto = new \PartFire\MangoPayBundle\Models\DTOs\User(); $userDto->setFirstName('Dick'); $userDto->setLastName('Jones'); $userDto->setBirthday(new \DateTime()); $userDto->setEmail('dick.jones@test.com'); $userDto->setNationality('GB'); $userDto->setCountryOfResidence('GB'); $userDtoUpdated = $userService->create($userDto); if ($userDtoUpdated instanceof \PartFire\MangoPayBundle\Models\DTOs\User) { $userDtoUpdated->getId(); //The users MangoPay ID, DTO fully populated. } if ($userDtoUpdated instanceof \PartFire\MangoPayBundle\Models\Exception) { //an error you can deal with } ``` ### Wallets #### Create a wallet ```php $walletService = $this->container->get('part_fire_mango_pay.services.wallet'); $walletDto = new \PartFire\MangoPayBundle\Models\DTOs\Wallet(); $walletDto->setTag('TAG1'); $walletDto->setOwenerId('123456'); //$walletDto->setOwenerIds(['123456']); $walletDto->setDescription('A natural users wallet'); $walletDto->setCurrency('GBP'); $walletDtoUpdated = $walletService->create($walletDto); if ($walletDtoUpdated instanceof \PartFire\MangoPayBundle\Models\DTOs\Wallet) { $walletDtoUpdated->getId(); //The wallet DTO populated with MangoPay ID. } if ($walletDtoUpdated instanceof \PartFire\MangoPayBundle\Models\Exception) { //an error you can deal with }
part_fire_mango_pay.services.user part_fire_mango_pay.services.wallet part_fire_mango_pay.services.kyc part_fire_mango_pay.services.transfer
In the 'Services' directory are the services that should be used my your client code. These services depend upon interfaces which are located inside the 'Models' directory. We then have an implementation of these abstractions in the 'Models/Adapters' directory. This means our services depend upon our abstractions, while the adapters also depend upon our abstractions., (*7)
The objects passed into the services and then adapters are simple DTOs (data type objects). These are just keys and values with setters and getters. We pass these in and out of the adapters so that none of our services / client code is dependant upon the MangoPay SDK., (*8)
Feel free to add more methods to the services etc and create a pull request. I will merge them in if they follow the existing structure or you teach me a better way., (*9)
A set of Symfony services for use in your project in integrate with MangoPay API faster.
MIT