WooRedsysAPI
in package
WooRedsysAPI class Handles encryption and communication with Redsys payment gateway.
Table of Contents
Properties
- $vars_pay : array<string|int, mixed>
- Holds the payment variables.
Methods
- array_to_json() : string
- Convert the payment array to JSON.
- base64_url_decode() : string
- Decode base64 URL-safe format to original data.
- base64_url_encode() : string
- Encode data to base64 URL-safe format.
- create_merchant_parameters() : string
- Create the merchant parameters by encoding the payment data in base64.
- create_merchant_signature() : string
- Create the merchant signature for Redsys payment gateway.
- create_merchant_signature_notif() : string
- Create merchant signature for notifications.
- create_merchant_signature_notif_soap_request() : string
- Create merchant signature for SOAP request notifications.
- create_merchant_signature_notif_soap_response() : string
- Create merchant signature for SOAP response notifications.
- decode_base64() : string
- Decode base64 data.
- decode_merchant_parameters() : string
- Decode merchant parameters from a base64-encoded string.
- encode_base64() : string
- Encode data to base64 format.
- encrypt_3des() : string
- Encrypt data using 3DES.
- get_order() : string
- Get the order number from payment variables.
- get_order_notif() : string
- Get the order number from notification data.
- get_order_notif_soap() : string
- Extract order number from SOAP data.
- get_parameter() : mixed
- Get a parameter value.
- get_request_notif_soap() : string
- Extract request data from SOAP.
- get_response_notif_soap() : string
- Extract response data from SOAP.
- mac256() : string
- Create HMAC SHA256 signature.
- set_parameter() : mixed
- Set a parameter for the payment.
- string_to_array() : mixed
- Convert a string into an array.
Properties
$vars_pay
Holds the payment variables.
private
array<string|int, mixed>
$vars_pay
= array()
Methods
array_to_json()
Convert the payment array to JSON.
public
array_to_json() : string
Return values
string —The JSON encoded payment data.
base64_url_decode()
Decode base64 URL-safe format to original data.
public
base64_url_decode(string $input) : string
Parameters
- $input : string
-
The encoded data.
Return values
string —The decoded data.
base64_url_encode()
Encode data to base64 URL-safe format.
public
base64_url_encode(string $input) : string
Parameters
- $input : string
-
The input data.
Return values
string —The encoded data.
create_merchant_parameters()
Create the merchant parameters by encoding the payment data in base64.
public
create_merchant_parameters() : string
Return values
string —The base64 encoded payment data.
create_merchant_signature()
Create the merchant signature for Redsys payment gateway.
public
create_merchant_signature(string $key) : string
Parameters
- $key : string
-
The key for signature creation.
Return values
string —The signature.
create_merchant_signature_notif()
Create merchant signature for notifications.
public
create_merchant_signature_notif(string $key, string $datos) : string
Parameters
- $key : string
-
The key for signature creation.
- $datos : string
-
The encoded data.
Return values
string —The signature.
create_merchant_signature_notif_soap_request()
Create merchant signature for SOAP request notifications.
public
create_merchant_signature_notif_soap_request(string $key, string $datos) : string
Parameters
- $key : string
-
The key for signature creation.
- $datos : string
-
The encoded data.
Return values
string —The signature.
create_merchant_signature_notif_soap_response()
Create merchant signature for SOAP response notifications.
public
create_merchant_signature_notif_soap_response(string $key, string $datos, string $num_pedido) : string
Parameters
- $key : string
-
The key for signature creation.
- $datos : string
-
The encoded data.
- $num_pedido : string
-
The order number.
Return values
string —The signature.
decode_base64()
Decode base64 data.
public
decode_base64(string $data) : string
Parameters
- $data : string
-
The encoded data.
Return values
string —The decoded data.
decode_merchant_parameters()
Decode merchant parameters from a base64-encoded string.
public
decode_merchant_parameters(string $datos) : string
Parameters
- $datos : string
-
The encoded data.
Return values
string —The decoded data.
encode_base64()
Encode data to base64 format.
public
encode_base64(string $data) : string
Parameters
- $data : string
-
The input data.
Return values
string —The base64 encoded data.
encrypt_3des()
Encrypt data using 3DES.
public
encrypt_3des(string $message, string $key) : string
Parameters
- $message : string
-
The message to encrypt.
- $key : string
-
The key used for encryption.
Return values
string —The encrypted message.
get_order()
Get the order number from payment variables.
public
get_order() : string
Return values
string —The order number.
get_order_notif()
Get the order number from notification data.
public
get_order_notif() : string
Return values
string —The order number.
get_order_notif_soap()
Extract order number from SOAP data.
public
get_order_notif_soap(string $datos) : string
Parameters
- $datos : string
-
The SOAP data.
Return values
string —The order number.
get_parameter()
Get a parameter value.
public
get_parameter(string $key) : mixed
Parameters
- $key : string
-
The parameter key.
Return values
mixed —The parameter value.
get_request_notif_soap()
Extract request data from SOAP.
public
get_request_notif_soap(string $datos) : string
Parameters
- $datos : string
-
The SOAP data.
Return values
string —The request data.
get_response_notif_soap()
Extract response data from SOAP.
public
get_response_notif_soap(string $datos) : string
Parameters
- $datos : string
-
The SOAP data.
Return values
string —The response data.
mac256()
Create HMAC SHA256 signature.
public
mac256(string $ent, string $key) : string
Parameters
- $ent : string
-
The string to hash.
- $key : string
-
The key used for the hash.
Return values
string —The resulting hash.
set_parameter()
Set a parameter for the payment.
public
set_parameter(string $key, mixed $value) : mixed
Parameters
- $key : string
-
The parameter key.
- $value : mixed
-
The parameter value.
string_to_array()
Convert a string into an array.
public
string_to_array(string $datos_decod) : mixed
Parameters
- $datos_decod : string
-
The JSON string.