WC_smartum_gateway_api
in package
handles the smartum api
Table of Contents
- $gateway : mixed
- the gateway object
- $production_url : mixed
- url for production api
- $response_url : mixed
- response url
- $staging_url : mixed
- url for stating api
- $url : mixed
- curren url in use
- $venue : mixed
- __construct() : mixed
- constructing the class
- get_checkout_url() : string
- fetches the checkout url
- get_request() : array<string|int, mixed>
- makes curl get request
- get_valid_benefits() : array<string|int, mixed>
- gets the valid benefits for a venue
- get_venue() : array<string|int, mixed>
- retrieves the venue information
- post_request() : array<string|int, mixed>
- makes a curl post request to the set endpoint
Properties
$gateway
the gateway object
public
mixed
$gateway
=
ull
$production_url
url for production api
public
mixed
$production_url
= 'https://api.smartum.fi/'
$response_url
response url
public
mixed
$response_url
=
ull
$staging_url
url for stating api
public
mixed
$staging_url
= 'https://api.staging.smartum.fi/'
$url
curren url in use
public
mixed
$url
= 'https://api.staging.smartum.fi/'
$venue
public
mixed
$venue
=
ull
Methods
__construct()
constructing the class
public
__construct(WC_Smartum_Gateway $gateway) : mixed
Parameters
- $gateway : WC_Smartum_Gateway
-
The gateway class instance
Return values
mixed —get_checkout_url()
fetches the checkout url
public
get_checkout_url(WC_Order $order, string $cancel_url, string $name, string $benefit) : string
Parameters
- $order : WC_Order
-
The WC_Order class instance
- $cancel_url : string
-
Return url if payment canceled
- $name : string
-
Name of the order
- $benefit : string
-
Name of the benefit type
Return values
string —The checkout url
get_request()
makes curl get request
public
get_request(string $url) : array<string|int, mixed>
Parameters
- $url : string
-
The ednpoint to send the request to
Return values
array<string|int, mixed> —Request response
get_valid_benefits()
gets the valid benefits for a venue
public
get_valid_benefits([int $venue_id = null ]) : array<string|int, mixed>
Parameters
- $venue_id : int = null
-
Venue to get valid benefits for
Return values
array<string|int, mixed> —Valid benefits
get_venue()
retrieves the venue information
public
get_venue(int $venue_id) : array<string|int, mixed>
Parameters
- $venue_id : int
-
The venue id to get
Return values
array<string|int, mixed> —Venue data
post_request()
makes a curl post request to the set endpoint
public
post_request(string $url, array<string|int, mixed> $body) : array<string|int, mixed>
Parameters
- $url : string
-
Endpoint for the request
- $body : array<string|int, mixed>
-
Array of data to be used in the request body
Return values
array<string|int, mixed> —Request response