Download the PHP package webgriffe/lib-monetaweb2 without Composer

On this page you can find all versions of the php package webgriffe/lib-monetaweb2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lib-monetaweb2

Webgriffe MonetaWeb 2.0 PHP library

Run Status

This library provides a complete integration for the XML Hosted 3DSecure protocol of Setefi MonetaWeb 2.0 payment gateway. It was developed following the technical documentation provided by Setefi released in July 2017.

Installation

In order to use this library, first of all import it using composer:

Usage

Payment initialization

You can generate a payment initialization URL using the GatewayClient class:

$gatewayClient = new Webgriffe\LibMonetaWebDue\Api\GatewayClient();
$getPaymentPageInfo = $gatewayClient->getPaymentPageInfo(
    'https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet',
    '99999999',
    '99999999',
    1428.7,
    'EUR',
    'ITA',
    'http://www.merchant.it/notify/',
    'http://www.merchant.it/error/',
    'TRCK0001',
    'Descrizione',
    'Nome Cognome',
    '[email protected]',
    'Campo Personalizzabile'
);

The getPaymentPageInfo method returns a GatewayPageInfo value object that encapsulates 3 values:

Server to server notification

Once that you redirected the user to the Hosted Page URL a server-to-server notification will be perfomed by MonetaWebDue to one of the 2 urls that you specified when you called getPaymentPageInfo. In the example of the payment initialization the user will be redirected to http://www.merchant.it/notify/ in case of successful operation and to http://www.merchant.it/error/ otherwise.

You can handle this request by using the handleNotify method of the GatewayClient class:

$gatewayClient = new Webgriffe\LibMonetaWebDue\Api\GatewayClient();
...
// $psrRequest must be an instance of an object that implements the \Psr\Http\Message\RequestInterface
$paymentResult = $gatewayClient->handleNotify($psrRequest);

The result of the handleNotify method could be a PaymentResultInfo object or a PaymentResultErrorInfo:

The Security Token is a value that is comunicated by Setefi both in the payment initialization response and the server to server notification. You should compare them to be ensure the integrity of the payment. In order to do this, the GatewayClient class has a method called verifySecurityToken that accepts the initialization's security token and the payment result info (returned by the handle notify) as parameters and returns a boolean:

$gatewayClient = new Webgriffe\LibMonetaWebDue\Api\GatewayClient();
...
$match = $gatewayClient->verifySecurityToken($storedSecurityToken, $paymentResult);

So an example of a real implementation for the server to server notification could be this:

$gatewayClient = new Webgriffe\LibMonetaWebDue\Api\GatewayClient();
...
$paymentResult = $gatewayClient->handleNotify($psrRequest);
if ($paymentResult instanceof PaymentResultErrorInfo) {
    ..
} else {
    /** @var PaymentResultInfo $paymentResult */
    if (!$paymentResult->isCanceled()) { // the security token is not returned if the payment was canceled
        if (!$gatewayClient->verifySecurityToken($storedSecurityToken, $paymentResult)) {
            // error
            ..
        }
    }
    ..
}

Contributing

Fork this repository, make your changes and submit a pull request. Please run the tests and the coding standards checks before submitting a pull request. You can do it with:

License

This library is under the MIT license. See the complete license in the LICENSE file.

Credits

Developed by Webgriffe®.


All versions of lib-monetaweb2 with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ^6.3
respect/validation Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webgriffe/lib-monetaweb2 contains the following files

Loading the files please wait ...