ekyna / payum-monetico
Payum Monetico (Credit Mutuel/CIC) 网关
1.7.2
2023-08-16 12:45 UTC
Requires
- ext-json: *
- payum/core: ^1.5
- psr/log: ^1.0|^2.0|^3.0
- sokil/php-isocodes: ^2.0|^3.0
- symfony/options-resolver: ^5.4|^6.0
Requires (Dev)
- php-http/guzzle7-adapter: ^1.0
- php-http/message-factory: ^1.1
- phpunit/phpunit: ^8.0|^9.0
README
Payum Monetico (Credit Mutuel/CIC/OBC) 支付网关。
安装/配置
composer req ekyna/payum-monetico
use Ekyna\Component\Payum\Monetico\Api\Api; use Ekyna\Component\Payum\Monetico\MoneticoGatewayFactory; $factory = new MoneticoGatewayFactory(); $gateway = $factory->create([ 'mode' => Api::MODE_PRODUCTION, 'tpe' => '123456', 'key' => '123456', 'company' => 'foobar', ]); // Register your convert payment action // $gateway->addAction(new \Acme\ConvertPaymentAction());
创建您的转换动作
查看 src/Action/ConvertPaymentAction.php 示例。
创建您的通知控制器
示例(Symfony)
public function notifyAction(Request $request) { // Get the reference you set in your ConvertAction if (null === $reference = $request->request->get('reference')) { throw new NotFoundHttpException(); } // Find your payment entity $payment = $this ->get('acme.repository.payment') ->findOneBy(['number' => $reference]); if (null === $payment) { throw new NotFoundHttpException(); } $payum = $this->get('payum'); // Execute notify & status actions. $gateway = $payum->getGateway('monetico'); $gateway->execute(new Notify($payment)); $gateway->execute(new GetHumanStatus($payment)); // Get the payment identity $identity = $payum->getStorage($payment)->identify($payment); // Invalidate payment tokens $tokens = $payum->getTokenStorage()->findBy([ 'details' => $identity, ]); foreach ($tokens as $token) { $payum->getHttpRequestVerifier()->invalidate($token); } // Return expected response return new Response(\Ekyna\Component\Payum\Monetico\Api\Api::NOTIFY_SUCCESS); }