troopers / mangopay-bundle
此扩展包包含Mangopay PHP SDK作为服务
3.0.5
2019-05-14 09:28 UTC
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
描述
此扩展包提供官方SDK PHP for Mangopay api V2集成到Symfony。
- 此分支支持v2.01 API版本。
- v1分支支持v2 API版本。
配置
troopers_mangopay: client_id: your_mangopay_client_id client_password: your_mangopay_client_password base_url: your_mangopay_base_url
如何使用它?
官方SDK提供了一个"MangoMapApi"类,它是一个访问所有"工具"(如"ApiPayIns"、"ApiWallets"、"ApiUsers"等)的快捷方式。您可以通过服务"troopers_mangopay.mango_api"访问这些"工具"。
$payIn = new PayIn(); $this->get('troopers_mangopay.mango_api')->PayIns->create($payIn);
辅助工具
此外,还有一些辅助工具可以处理大多数Mangopay操作。欢迎您分叉并实现自己的。
BankInformationHelper
它可以注册用户银行信息,因为它实现了BankInformationInterface。
$bankInformation = new BankInformation(); $this->get('troopers_mangopay.bank_information_helper')->createBankAccount($bankInformation);
PaymentHelper
它可以注册卡预授权并执行它。
$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
它可以创建一个新的直接支付。
$transaction = new Transaction(); $this->get('troopers_mangopay.payment_direct_helper')->createDirectTransaction($transaction);
UserHelper
它可以创建一个新的Mangopay用户,因为用户对象实现了UserInterface。
$user = new User(); $this->get('troopers_mangopay.user_helper')->createMangoUser($user);
WalletHelper
它可以创建一个用户钱包。
$user = new User(); $this->get('troopers_mangopay.wallet_helper')->createWalletForUser($user);
一般工作流程
这是Mangopay支付页面的通用工作流程。
- 向用户显示支付表单
- 通过Mangopay API创建Mangopay用户和卡注册