shivella/ideal-bundle

此包已被废弃,不再维护。作者建议使用 ruudk/payment-mollie-bundle 包。

Symfony iDeal Bundle

1.0.6 2018-09-18 09:14 UTC

This package is not auto-updated.

Last update: 2020-01-26 01:14:51 UTC


README

请考虑使用: https://github.com/ruudk/PaymentMollieBundle

Mollie iDeal Bundle

此 Symfony3 Bundle 为 Mollie 的 iDEAL 支付提供了支持。它使用 Mollie-api。需要一个 Mollie 账户。

更多信息请参阅 Mollie

Latest Stable Version License Total Downloads Coverage Status Scrutinizer Code Quality

安装

安装是一个快速的三步过程

  1. 使用 composer 下载 ideal-bundle
  2. 在 AppKernel.php 中启用 Bundle
  3. 配置您的 Mollie 凭据

第 1 步:使用 composer 下载 ideal-bundle

运行以下命令添加 UsoftIDealBundle

$ composer require shivella/ideal-bundle

第 2 步:在 AppKernel.php 中启用 Bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Usoft\IDealBundle\UsoftIDealBundle(),
    );
}

第 3 步:配置 Mollie 凭据

# app/config/config.yml

# ideal Mollie
usoft_i_deal:
    mollie:
        key: secret_mollie_key
        description: "Mollie payment"

在 Controller 中的使用

<?php
// Acme/Bundle/OrderController.php

public function paymentAction(Request $request)
{   
    $form = $this->createForm(IdealType::class);
    $form->handleRequest($request);

    if ($form->isValid()) {
    
        $mollie = $this->get('mollie');
        $bank = new Bank($form->get('bank')->getData());
        $amount = (float) 120.99;

        return $mollie->execute($bank, $amount, 'route_to_confirm_action');
    }
    
    return $this->render('payment.html.twig', ['form' => $form->createView()]);
}

/**
 * @Route("/order/confirm", name="route_to_confirm_action")
 *
 * @param Request $request
 */
public function confirmAction(Request $request)
{
    if ($this->get('mollie')->confirm($request)) {
        // handle order....
    } else {
        // Something went wrong...
    }
}