# OpenAPIClient-php

This is a \"swagger\" definition of application programming interface of the MúzaPay by Benefit Plus e-commerce payment gateway. You may leverage this API from your e-shop to integrate payments by employee-benefits-programme funds. This version of the programme uses mobile payment application MúzaPay. <br/><br/> <b>Requests signing</b></br></br>All requests except <code>/auth/token</code> must be signed by \"SHA-256 with RSA\" (RSASSA-PKCS1-v1_5,  <a href=\"https://datatracker.ietf.org/doc/html/rfc8017#section-8.2\" target=\"_blank\" rel=\"noopener noreferrer\">RFC 8017 chapter 8.2</a>) electronic signatures. See online gateway documentation for details.
## Change log
* v2 - 2025-06-26
  * Added HEALTH value to <code>productCode</code> enum as mandated by the Czech state legislation.
  * <code>amountAuthorized</code> in <code>PaymentStateResponse</code> renamed to <code>remainingAmount</code> to better capture its meaining.
  * Added HTTP 410 Gone response to the <code>cancelPayment()</code> operation.
  * Corrected pattern of <code>orderReferenceCode</code>
  * Multiple corrections of the documentation, examples and field ordering changes - non-impacting. 
<br/><br/>

For more information, please visit [https://profirmy.benefit-plus.cz/podpora/](https://profirmy.benefit-plus.cz/podpora/).

## Installation & Usage

### Requirements

PHP 7.4 and later.
Should also work with PHP 8.0.

### Composer

To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:

```json
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/wpify/benefit-plus-gateway-sdk.git"
    }
  ],
  "require": {
    "wpify/benefit-plus-gateway-sdk": "*@dev"
  }
}
```

Then run `composer install`

### Manual Installation

Download the files and include `autoload.php`:

```php
<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
```

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure Bearer (JWT) authorization: bearerAuth
$config = BenefitPlusGatewaySdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new BenefitPlusGatewaySdk\Api\LandingPageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->getLandingPage();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LandingPageApi->getLandingPage: ', $e->getMessage(), PHP_EOL;
}

```

## API Endpoints

All URIs are relative to *https://api.gate.muzapay.cz*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*LandingPageApi* | [**getLandingPage**](docs/Api/LandingPageApi.md#getlandingpage) | **GET** / | 
*MerchantEShopAuthenticationApi* | [**authenticate**](docs/Api/MerchantEShopAuthenticationApi.md#authenticate) | **POST** /v2/auth/token | authenticate()
*MerchantPaymentApi* | [**cancelPayment**](docs/Api/MerchantPaymentApi.md#cancelpayment) | **PUT** /v2/payments/{paymentId}/cancel | cancelPayment()
*MerchantPaymentApi* | [**getPaymentState**](docs/Api/MerchantPaymentApi.md#getpaymentstate) | **GET** /v2/payments/{paymentId}/state | getPaymentState()
*MerchantPaymentApi* | [**initPayment**](docs/Api/MerchantPaymentApi.md#initpayment) | **POST** /v2/payments/init | initPayment()

## Models

- [AuthenticationRequest](docs/Model/AuthenticationRequest.md)
- [AuthenticationResponse](docs/Model/AuthenticationResponse.md)
- [BadRequestErrorResponse](docs/Model/BadRequestErrorResponse.md)
- [Currency](docs/Model/Currency.md)
- [ErrorResponse](docs/Model/ErrorResponse.md)
- [GoneResponse](docs/Model/GoneResponse.md)
- [InitPaymentRequest](docs/Model/InitPaymentRequest.md)
- [InitPaymentResponse](docs/Model/InitPaymentResponse.md)
- [PaymentStateResponse](docs/Model/PaymentStateResponse.md)

## Authorization

Authentication schemes defined for the API:
### basicAuth

- **Type**: HTTP basic authentication

### bearerAuth

- **Type**: Bearer authentication (JWT)

## Tests

To run the tests, use:

```bash
composer install
vendor/bin/phpunit
```

## Author

partneri@benefit-plus.cz

## About this package

This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: `2.0`
    - Generator version: `7.12.0`
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`
