承接 jakubzapletal/payment-webpay-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jakubzapletal/payment-webpay-bundle

Composer 安装命令:

composer require jakubzapletal/payment-webpay-bundle

包简介

Payment Bundle for Symfony2 providing an access to the GP webpay API

README 文档

README

Total Downloads Latest Unstable Version License

This is an extension to the JMSPaymentCoreBundle providing an access to the GP Webpay API (https://www.globalpaymentsinc.com).

Available Transaction Types:

  • approveAndDeposit

Instalation

Composer

If you don't have Composer install it:

$ curl -s https://getcomposer.org/installer | php

Add jakubzapletal/payment-webpay-bundle to composer.json:

$ composer require "jakubzapletal/payment-webpay-bundle:1.0.*@dev"

Register a bundle

<?php

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new JakubZapletal\Payment\WebpayBundle\JakubZapletalPaymentWebpayBundle(),
    // ...
);

Dependencies

This plugin depends on the JMSPaymentCoreBundle, so you'll need to add this to your kernel as well even if you don't want to use its persistence capabilities.

Configuration

jakub_zapletal_payment_webpay:
    bank_name: short name of your bank # example 'rb'
    merchant_number: your merchant number obtained from GP webpay or your bank
    private_key_path: absolute path to your private key *.pem file # example '%kernel.root_dir%/Resources/private_key.pem'
    private_key_password: password to your private key
    muzo_key_path: absolute path to muzo key *.pem file # example '%kernel.root_dir%/Resource/muzo_prod.pem'
    debug: true/false # when true, connect to Webpay test; uses kernel debug value when not specified

Usage

With the Payment Plugin Controller (Recommended)

Example is inspired by official JMSPaymentCorebundle usage. There is shown only a different part than the official one.

// class PaymentController

    // ...

    /**
     * @Route("/{orderNumber}/details", name = "payment_details")
     * @Template
     */
    public function detailsAction(Order $order)
    {
        $form = $this->getFormFactory()->create('jms_choose_payment_method', null, array(
            'amount'   => $order->getAmount(),
            'currency' => 'EUR',
            'default_method' => 'payment_webpay', // Optional
            'predefined_data' => array(
                'webpay' => array(
                    'return_url' => $this->router->generate('payment_complete', array(
                        'orderNumber' => $order->getOrderNumber(),
                    ), true),
                    'merchantOrderNumber' => $order->getId(), // Optional
                    'description' => (string)$order->getProduct() // Optional
                )
            ),
        ));

        if ('POST' === $this->request->getMethod()) {
            $form->bindRequest($this->request);

            if ($form->isValid()) {
                $this->ppc->createPaymentInstruction($instruction = $form->getData());

                $order->setPaymentInstruction($instruction);
                $this->em->persist($order);
                $this->em->flush($order);

                return new RedirectResponse($this->router->generate('payment_complete', array(
                    'orderNumber' => $order->getOrderNumber(),
                )));
            }
        }

        return array(
            'form' => $form->createView()
        );
    }

    // ...

Without the Payment Plugin Controller

The Payment Plugin Controller is made available by the CoreBundle and basically is the interface to a persistence backend like the Doctrine ORM. It also performs additional integrity checks to validate transactions. If you don’t need these checks, and only want an easy way to communicate with the Webpay API, then you can use the plugin directly:

$plugin = $container->get('jakub_zapletal.payment.webpay.plugin.webpay');

Contributing

Contributions are welcome! Please see the Contribution Guidelines.

统计信息

  • 总下载量: 245
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固