Skip to content

Commit

Permalink
Fixed readme and configuration entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiabasone committed Feb 22, 2019
1 parent f7a5125 commit 2e7667d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ $init = new \PagOnline\Init\IgfsCgInit();
$init->serverURL = "https://payment-gateway-example.com/IGFS_CG_SERVICES/services";
$init->tid = "MY-TID-CODE";
$init->kSig = '1234567890987654321';
$init->timeout = 15000;
$init->shopID = 'my-transaction-id';
$init->shopUserRef = "[email protected]";
$init->trType = "AUTH";
Expand All @@ -31,6 +30,13 @@ $init->notifyURL = "http://my-domain.tld/verify.php";
$init->errorURL = "http://my-domain.tld/error.php";
$init->addInfo1 = 'myFirstAddintionalInfo';

// if you need to edit http client parameters...
$init->setRequestTimeout(10); // Seconds
$init->setConnectTimeout(5); // Seconds
$init->setHttpProxy('tcp://some.proxy'); // Proxy server for requests
$init->setHttpAuthUser('username'); // HTTP Basic Auth username
$init->setHttpAuthPass('password'); // HTTP Basic Auth password

if (!$init->execute()) {
// Something went wrong
} else {
Expand All @@ -48,7 +54,8 @@ to copy `pagonline.php` config file

Set the following environment variables in your `.env` file:
- `PAGONLINE_SERVER_URL` payment gateway server url (_default: null_)
- `PAGONLINE_TIMEOUT` maximum timeout in milliseconds for completing a request (_default: 15000_)
- `PAGONLINE_REQUEST_TIMEOUT` maximum timeout in seconds for completing a request (_default: 15_)
- `PAGONLINE_CONNECT_TIMEOUT` maximum timeout in seconds for connecting to the server (_default: 5_)
- `PAGONLINE_TERMINAL_ID` identifier provided by the payment gateway (_default: null_)
- `PAGONLINE_SIGNATURE_KEY` signature key provided by the payment gateway (_default: null_)
- `PAGONLINE_CURRENCY_CODE` currency code (_default: EUR_)
Expand Down
8 changes: 7 additions & 1 deletion config/pagonline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

return [
'server_url' => env('PAGONLINE_SERVER_URL', null),
'timeout' => env('PAGONLINE_TIMEOUT', 15000),
'request_timeout' => env('PAGONLINE_REQUEST_TIMEOUT', 15),
'connect_timeout' => env('PAGONLINE_CONNECT_TIMEOUT', 5),

'http_proxy' => env('PAGONLINE_HTTP_PROXY', ''),
'http_basic_auth_user' => env('PAGONLINE_HTTP_BASIC_AUTH_USER', ''),
'http_basic_auth_pass' => env('PAGONLINE_HTTP_BASIC_AUTH_PASS', ''),

// tid
'terminal_id' => env('PAGONLINE_TERMINAL_ID', null),
// kSig
Expand Down
7 changes: 6 additions & 1 deletion src/IgfsCgFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ public static function make(string $namespace): IgfsCgInterface
$igfsCgClass->currencyCode = Config::get('pagonline.currency_code');
$igfsCgClass->langID = Config::get('pagonline.language_id');

$igfsCgClass->setRequestTimeout((int) Config::get('pagonline.timeout'));
// HTTP configuration
$igfsCgClass->setRequestTimeout((int) Config::get('pagonline.request_timeout'));
$igfsCgClass->setConnectTimeout((int) Config::get('pagonline.connect_timeout'));
$igfsCgClass->setHttpProxy(Config::get('pagonline.http_proxy'));
$igfsCgClass->setHttpAuthUser(Config::get('pagonline.http_basic_auth_user'));
$igfsCgClass->setHttpAuthUser(Config::get('pagonline.http_basic_auth_pass'));
}

return $igfsCgClass;
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ trait HttpClient
/**
* @var string
*/
protected $httpAuthUser;
protected $httpAuthUser = '';

/**
* @var string
*/
protected $httpAuthPass;
protected $httpAuthPass = '';

/**
* @var string
*/
protected $httpProxy;
protected $httpProxy = '';

/**
* @param array $configuration
Expand Down

0 comments on commit 2e7667d

Please sign in to comment.