-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample.configurationRequest.php
executable file
·38 lines (27 loc) · 1.54 KB
/
example.configurationRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require __DIR__ . '/vendor/autoload.php';
require_once "ratepay_credentials.php";
/**********************************************************
* The ConfigurationRequest the installment configuration *
**********************************************************/
// ConfigurationRequest needs 'head' only
$mbHead = new RatePAY\ModelBuilder();
$mbHead->setArray([
'SystemId' => "Example",
'Credential' => [
'ProfileId' => PROFILE_ID,
'Securitycode' => SECURITYCODE
]
]);
$rb = new RatePAY\RequestBuilder(true); // Sandbox mode = true
$configurationRequest = $rb->callConfigurationRequest($mbHead);
if (!$configurationRequest->isSuccessful()) die("ConfigurationRequest not successful");
// The ConfigurationRequest response object provides following methods:
// getAllowedMonths(); // Returns list of allowed months {array} @param: order amount {numeric} is optional but recommended
// getMinRate(); // Returns minimum rate {float}
// getMaxRate(order amount); // Returns maximum rate {float} @param: order amount {numeric} is mandatory
var_dump($configurationRequest->getAllowedMonths());
var_dump($configurationRequest->getMinRate());
/*********************************************************************************************************************************
* The library throws decidedly exceptions. It's recommended to surround model building and request calls with try-catch-blocks. *
*********************************************************************************************************************************/