2017 © Pedro Peláez
 

library wirecard-bundle

Bundle which integrates the hochstrasser/wirecard library

image

hochstrasserio/wirecard-bundle

Bundle which integrates the hochstrasser/wirecard library

  • Thursday, August 10, 2017
  • by chh
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7,425 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 28 % Grown

The README.md

wirecard-bundle

Install

Install the package with Composer:, (*1)

composer require 'hochstrasserio/wirecard-bundle:dev-master'

Add the bundle to your AppKernel:, (*2)

// AppKernel.php
$bundles = [
    …
    new Hochstrasser\WirecardBundle\HochstrasserWirecardBundle(),
    …
];

Usage

Bundle Reference Configuration

hochstrasser_wirecard:
    # Checkout language, required
    language: ~
    # Customer ID, required
    customer_id: ~
    # Secret, required
    secret: ~
    # Shop ID, optional
    shop_id: ~
    # Password for backend requests, optional
    backend_password: ~
    # User agent used for requests, change this to your app name
    user_agent: "Hochstrasser/Wirecard"
    # Version of DataStorage JS, possible values are null and "pci3"
    javascript_script_version: ~

Retrieving the Wirecard Context

<?php

$context = $this->get('hochstrasser_wirecard.context');

Using the WirecardController to handle confirm requests

This bundle includes an implementation of a controller to handle requests sent to the confirmUrl parameter supplied to payment requests., (*3)

The confirmUrl parameter sets a URL which is updated with a request from Wirecard with payment information and state., (*4)

Register the controller in your routing configuration to enable this feature:, (*5)

wirecard_confirm:
    path: /wirecard/confirm
    defaults:
        _controller: hochstrasser_wirecard.wirecard_controller:confirmAction

Then pass the URL to the InitPaymentRequest:, (*6)

<?php

$request->setConfirmUrl($this->generateUrl('wirecard_confirm'), [], UrlGeneratorInterface::ABSOLUTE_URL);

The controller then checks the responseFingerprint. When the fingerprint is valid, it triggers the Hochstrasser\WirecardBundle\Event\ConfirmPaymentEvent in the app's event dispatcher., (*7)

Handle this event to implement your business logic, e.g. queuing an order confirmation email., (*8)

For example:, (*9)

<?php

use Hochstrasser\WirecardBundle\Event\ConfirmPaymentEvent;

$listener = function (ConfirmPaymentEvent $event) {
    // Response parameters
    // See: https://guides.wirecard.at/response_parameters
    $data = $event->getData();

    if ($event->isPaymentState(ConfirmPaymentEvent::SUCCESS)) {
        // We got the payment, queue order confirmation email
    } else if ($event->isPaymentState(ConfirmPaymentEvent::FAILURE)) {
        // Notify the user that something went wrong with the payment, and order
        // is on hold
    }
};

The ConfirmPaymentEvent contains also constants for the Wirecard payment response states:, (*10)

  • SUCCESS: Payment was successful, e.g. send order confirmation
  • PENDING: Payment is still processing
  • CANCEL: Payment was cancelled by the customer
  • FAILURE: Payment failure, i.e. notify the user that the order could not be processed

The Versions

10/08 2017

dev-master

9999999-dev

Bundle which integrates the hochstrasser/wirecard library

  Sources   Download

MIT

The Requires

 

The Development Requires

10/08 2017

v1.1.0

1.1.0.0

Bundle which integrates the hochstrasser/wirecard library

  Sources   Download

MIT

The Requires

 

The Development Requires

06/12 2016

v1.0.0

1.0.0.0

Bundle which integrates the hochstrasser/wirecard library

  Sources   Download

The Requires

 

The Development Requires