Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ $connector_shared_secret = "your_generated_connector_shared_secret";
$client = new Client($api_user, $api_password, $connector_api_key, $connector_shared_secret);
```

If you want to use `sha512` as hash algorithm for the security signature you can instantiate the client like this:

```php
<?php

use Ixopay\Client\Client;
use Ixopay\Client\Data\Customer;
use Ixopay\Client\Transaction\Debit;
use Ixopay\Client\Transaction\Result;

// Include the autoloader (if not already done via Composer autoloader)
require_once('path/to/initClientAutoload.php');

// Instantiate the "Ixopay\Client\Client" with your credentials
$api_user = "your_username";
$api_password = "your_username";
$connector_api_key = "your_chosen_connector_api_key";
$connector_shared_secret = "your_generated_connector_shared_secret";
$client = new Client($api_user, $api_password, $connector_api_key, $connector_shared_secret, null, true);
```

### Process a debit transaction

Once you instantiated a [client with credentials](#setting-up-credentials),
Expand Down
11 changes: 9 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,28 @@ class Client
*/
protected $generator;

/**
* @var bool
*/
protected $newAlgo = false;

/**
* @param string $username
* @param string $password
* @param string $apiKey
* @param string $sharedSecret
* @param string $language
* @param bool $testMode - DEPRECATED
* @param bool $newAlgo
*/
public function __construct($username, $password, $apiKey, $sharedSecret, $language = null, $testMode = false) {
public function __construct($username, $password, $apiKey, $sharedSecret, $language = null, $testMode = false, $newAlgo = false) {
$this->username = $username;
$this->setPassword($password);
$this->apiKey = $apiKey;
$this->sharedSecret = $sharedSecret;
$this->language = $language;
$this->testMode = $testMode;
$this->newAlgo = $newAlgo;
}

/**
Expand Down Expand Up @@ -694,7 +701,7 @@ public function signAndSendJson($jsonBody, $url, $username, $password, $apiKey,
$curl = new CurlClient();
$curl ->setCustomHeaders($this->customRequestHeaders)
->setCustomCurlOptions($this->customCurlOptions);
$curl->signJson($sharedSecret, $url, $jsonBody, $type)
$curl->signJson($sharedSecret, $url, $jsonBody, $type, false, $this->newAlgo)
->setAuthentication($username, $password);

if($get){
Expand Down