<?php
namespace PhpOffice\PhpSpreadsheet\Worksheet;
class PageMargins
{
/**
* Left.
*
* @var float
*/
private $left = 0.7;
/**
* Right.
*
* @var float
*/
private $right = 0.7;
/**
* Top.
*
* @var float
*/
private $top = 0.75;
/**
* Bottom.
*
* @var float
*/
private $bottom = 0.75;
/**
* Header.
*
* @var float
*/
private $header = 0.3;
/**
* Footer.
*
* @var float
*/
private $footer = 0.3;
/**
* Create a new PageMargins.
*/
public function __construct()
{
}
/**
* Get Left.
*
* @return float
*/
public function getLeft()
{
return $this->left;
}
/**
* Set Left.
*
* @param float $left
*
* @return $this
*/
public function setLeft($left)
{
$this->left = $left;
return $this;
}
/**
* Get Right.
*
* @return float
*/
public function getRight()
{
return $this->right;
}
/**
* Set Right.
*
* @param float $right
*
* @return $this
*/
public function setRight($right)
{
$this->right = $right;
return $this;
}
/**
* Get Top.
*
* @return float
*/
public function getTop()
{
return $this->top;
}
/**
* Set Top.
*
* @param float $top
*
* @return $this
*/
public function setTop($top)
{
$this->top = $top;
return $this;
}
/**
* Get Bottom.
*
* @return float
*/
public function getBottom()
{
return $this->bottom;
}
/**
* Set Bottom.
*
* @param float $bottom
*
* @return $this
*/
public function setBottom($bottom)
{
$this->bottom = $bottom;
return $this;
}
/**
* Get Header.
*
* @return float
*/
public function getHeader()
{
return $this->header;
}
/**
* Set Header.
*
* @param float $header
*
* @return $this
*/
public function setHeader($header)
{
$this->header = $header;
return $this;
}
/**
* Get Footer.
*
* @return float
*/
public function getFooter()
{
return $this->footer;
}
/**
* Set Footer.
*
* @param float $footer
*
* @return $this
*/
public function setFooter($footer)
{
$this->footer = $footer;
return $this;
}
public static function fromCentimeters(float $value): float
{
return $value / 2.54;
}
public static function toCentimeters(float $value): float
{
return $value * 2.54;
}
public static function fromMillimeters(float $value): float
{
return $value / 25.4;
}
public static function toMillimeters(float $value): float
{
return $value * 25.4;
}
public static function fromPoints(float $value): float
{
return $value / 72;
}
public static function toPoints(float $value): float
{
return $value * 72;
}
}
Get access token to initiates payment transaction.
generate-token
| Parameter | Type | Comments |
|---|---|---|
| client_id | string | Enter merchant API client/primary key |
| secret_id | string | Enter merchant API secret key |
| env | string | Enter merchant API environment |
| merchant_id | string | Enter merchant API merchant id |
Request Example (guzzle)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', $base_url. 'v1/generate-token', [
'headers' => [
'accept' => 'application/json',
'content-type' => 'application/json',
],
'form_params' => [
'client_id' => '$client_id',
'secret_id' => 'secret_id',
'env' => 'env',
'merchant_id' => 'merchant_id',
],
]);
echo $response->getBody();
**Response: SUCCESS (200 OK)**
{
"message": {
"success": [
"Successfully token is generated"
]
},
"data": {
"token":"eyJpdiI6InpkczhjTjhQdVhUL2lKQ0pSUUx6aUE9PSIsInZhbHVlIjoiVGVBTVBDTXltbjNZcEIvdEJveGpTSno3TU5NRUtnVkhCZ1pHTFNCUnZGQ2UxMnYxN202cEE1YVRDTEFsc0ZERExoTjdtL0dTL2xoU3QzeUJJOExiMUx5T0w1L0llUXhTUkU1cWVLWEdEbEplb0dKNXcwbTNRM0VxdkUwYzZuNFdtNkhMQ0pRZysyNWkvdzBxSlBoSVBSOGFTekNnR2RXNHVtcG9lMGZOTmNCcm1hR3c5Sk9KTnB4Y3ltZDl6cm90MThrR21Ca3B1azc3bXRiQ0J6SW96UVo1elNkU1ZqeE05bTcwWGp1MEUxWlJFdnNWTmpSbnVpeW92b2U4dXZkUGgyb1VmK0luaGdyaFlsVTZlcVpVRnZlTG1DeFF6Ykk2T2h6Z3JzbnIyNHpNdHowSE5JdDR0Y0pZT20zUm1XYW8iLCJtYWMiOiJlY2M4NGE1OGUzYzkzYzk0YzljNmVmNjE0YWI0ZDIwOGI3NDQ2YWEyY2ZhNzc0NzE4ZmY1ZmYyMz
IyZmQzNDY1IiwidGFnIjoiIn0=",
},
"type": "success"
}
**Response: ERROR (400 FAILED)**
{
"message": {
"error": [
"Invalid credentials."
]
},
"data": null,
"type": "error"
}