Git Product home page Git Product logo

payum-axepta-bnp's Introduction

Payum Axepta by BNP

A Payum gateway to use Axepta (a French payment system)

Latest Stable Version Build Status

Requirements

Installation

$ composer require yproximite/payum-axepta-bnp

Configuration

With PayumBundle (Symfony)

First register the gateway factory in your services definition:

# config/services.yaml or app/config/services.yml
services:
  yproximite.axepta_gateway_factory:
    class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder
    arguments: [ Yproximite\Payum\Axepta\AxeptaGatewayFactory ]
    tags:
      - { name: payum.gateway_factory_builder, factory: axepta }

Then configure the gateway:

# config/packages/payum.yaml or app/config/config.yml

payum:
  gateways:
    axepta:
      factory: axepta
      merchant_id: 'change it' # required
      hmac: 'change it' # required
      crypt_key: 'change it' # required

With Payum

<?php
//config.php

use Payum\Core\PayumBuilder;
use Payum\Core\Payum;

/** @var Payum $payum */
$payum = (new PayumBuilder())
    ->addDefaultStorages()

    ->addGateway('gatewayName', [
        'factory'     => 'axepta',
        'merchant_id' => 'change it', // required
        'hmac'        => 'change it', // required
        'crypt_key'   => 'change it', // required
    ])

    ->getPayum()
;

Usage

Make sure your Payment entity overrides getNumber() method like this:

<?php

namespace App\Entity\Payment;

use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\Payment as BasePayment;

/**
 * @ORM\Table
 * @ORM\Entity
 */
class Payment extends BasePayment
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     *
     * @var int
     */
    protected $id;

    /**
     * {@inheritdoc}
     */
    public function getNumber()
    {
        return (string) $this->id;
    }
}

By doing this, the library will be able to pick the payment's id and use it for the payment with Axepta.

payum-axepta-bnp's People

Contributors

romulused69 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

arnaud-ritti

payum-axepta-bnp's Issues

Token not found after payment - Query parameters are added on the callback url

Hello!

I'm trying to use Axepta with your bundle. The payment is working, but there is an error on the callback:

// https://127.0.0.1:8000/admin/payment/callback?payum_token=J3ijH1J8RdhWAtPU4AWwxA-vUNAQIQggYGvwR132wk8?Len=655&Data=...
A token with hash `J3ijH1J8RdhWAtPU4AWwxA-vUNAQIQggYGvwR132wk8?Len=655` could not be found.

Has you can see, there is a ?Len=655&Data= after the callback url generated by Payum...

My prepare route is :

/**
     * @Route("/prepare", name="prepare", methods={"GET"})
     */
    public function prepare(Payum $payum)
    {
        $gatewayName = 'axepta';

        $storage = $payum->getStorage('App\Entity\Payment');

        $payment = $storage->create();
        $payment->setNumber(uniqid());
        $payment->setCurrencyCode('EUR');
        $payment->setTotalAmount(123); // 1.23 EUR
        $payment->setDescription('Test');
        $payment->setClientId('1');
        $payment->setClientEmail('[email protected]');

        $storage->update($payment);

        $captureToken = $payum->getTokenFactory()->createCaptureToken(
            $gatewayName,
            $payment,
            $this->generateUrl("admin_payment_callback", [], UrlGeneratorInterface::ABSOLUTE_URL) // the route to redirect after capture
        );

        return $this->redirect($captureToken->getTargetUrl());
    }

The callback route is simply :

    /**
     * @Route("/callback", name="callback", methods={"GET"})
     */
    public function callback(Request $request, Payum $payum)
    {
        $token = $payum->getHttpRequestVerifier()->verify($request);
    }

Do you have any idea on how it could be fixed?

Error on installing package

Hi,
Hope your are doing well.

I'm trying to install your package but I have got this below error message:

[InvalidArgumentException] Could not find a matching version of package yproximite/payum-axepta-bnp. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stab ility (stable).

I'm using:

  • Composer v1
  • OS : Windows 10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.