Defines Class
The Defines class serves as a centralized container for constant values used throughout the myPOS IPC PHP SDK. These constants control data formats, error/status codes, encryption settings, and more.
Class Details
- Namespace:
Mypos\IPC - Located at:
Defines.php - Purpose: SDK-wide constants for formats, status codes, cryptography, and IPC communication.
Communication Formats
| Constant | Value | Description |
|---|---|---|
COMMUNICATION_FORMAT_XML | 'xml' | API communication format in XML. |
COMMUNICATION_FORMAT_JSON | 'json' | API communication format in JSON (recommended). |
COMMUNICATION_FORMAT_POST | 'post' | API communication via HTML form POST. |
Cryptography
| Constant | Value | Description |
|---|---|---|
SIGNATURE_ALGO | OPENSSL_ALGO_SHA256 | Algorithm used to sign requests. |
ENCRYPT_PADDING | OPENSSL_PKCS1_PADDING | RSA encryption padding method. |
Status Codes
These constants are returned by API responses and indicate the success or failure of an operation.
| Constant | Value | Description |
|---|---|---|
STATUS_SUCCESS | 0 | Operation was successful. |
STATUS_MISSING_REQ_PARAMS | 1 | Required parameters are missing. |
STATUS_SIGNATURE_FAILED | 2 | Signature verification failed. |
STATUS_IPC_ERROR | 3 | IPC-specific error occurred. |
STATUS_INVALID_SID | 4 | Invalid Store ID. |
STATUS_INVALID_PARAMS | 5 | One or more parameters are invalid. |
STATUS_INVALID_REFERER | 6 | Invalid referer URL. |
STATUS_PAYMENT_TRIES | 7 | Maximum payment attempts reached. |
STATUS_TRANSACTION_AUTH_FAIL | 8 | Transaction authorization failed. |
STATUS_WRONG_AMOUNT | 9 | Transaction amount is incorrect. |
STATUS_UNSUPPORTED_CALL | 10 | Unsupported API operation. |
STATUS_INACTIVE_MANDATE_REFERENCE | 11 | Mandate reference is inactive. |
STATUS_INVALID_MANDATE_REFERENCE | 12 | Mandate reference is invalid. |
STATUS_NOT_SUFFICIENT_FUNDS | 13 | Insufficient funds. |
STATUS_TRANSACTION_NOT_PERMITTED | 14 | Transaction not permitted. |
STATUS_EXCEEDED_LIMIT | 15 | Transaction limit exceeded. |
STATUS_MANDATE_ALREADY_REGISTERED | 16 | Mandate already exists. |
STATUS_INACTIVE_ACOUNTIDENTIFIER | 17 | Account identifier is inactive. |
STATUS_INVALID_ACOUNTIDENTIFIER | 18 | Invalid account identifier. |
STATUS_EXCEEDED_ACCOUNT_LIMITS | 19 | Account limits exceeded. |
STATUS_DUPLICATE_TRANSMISSION | 20 | Duplicate transaction detected. |
STATUS_TRANSACTION_DECLINED | 21 | Transaction declined. |
STATUS_UNDEFINED_ERROR | 99 | Unknown error occurred. |
Example Usage
<?php
namespace Mypos\IPC;
/**
* Container for SDK constants
*/
class Defines
{
const COMMUNICATION_FORMAT_XML = 'xml';
const COMMUNICATION_FORMAT_JSON = 'json';
const COMMUNICATION_FORMAT_POST = 'post';
const SIGNATURE_ALGO = OPENSSL_ALGO_SHA256;
const AVL_CURRENCIES = 'EUR;USD;GBP;HRK;CHF;RON;JPY;BGN';
const STATUS_SUCCESS = 0;
const STATUS_MISSING_REQ_PARAMS = 1;
const STATUS_SIGNATURE_FAILED = 2;
const STATUS_IPC_ERROR = 3;
const STATUS_INVALID_SID = 4;
const STATUS_INVALID_PARAMS = 5;
const STATUS_INVALID_REFERER = 6;
const STATUS_PAYMENT_TRIES = 7;
const STATUS_TRANSACTION_AUTH_FAIL = 8;
const STATUS_WRONG_AMOUNT = 9;
const STATUS_UNSUPPORTED_CALL = 10;
const STATUS_INACTIVE_MANDATE_REFERENCE = 11;
const STATUS_INVALID_MANDATE_REFERENCE = 12;
const STATUS_NOT_SUFFICIENT_FUNDS = 13;
const STATUS_TRANSACTION_NOT_PERMITTED = 14;
const STATUS_EXCEEDED_LIMIT = 15;
const STATUS_MANDATE_ALREADY_REGISTERED = 16;
const STATUS_INACTIVE_ACOUNTIDENTIFIER = 17;
const STATUS_INVALID_ACOUNTIDENTIFIER = 18;
const STATUS_EXCEEDED_ACCOUNT_LIMITS = 19;
const STATUS_DUPLICATE_TRANSMISSION = 20;
const STATUS_TRANSACTION_DECLINED = 21;
const STATUS_UNDEFINED_ERROR = 99;
const ENCRYPT_PADDING = OPENSSL_PKCS1_PADDING;
private function __construct() { }
}
Tip for Developers
You can use these constants to:
- Handle API response statuses more reliably
- Switch communication formats (JSON is recommended)
- Ensure proper use of signing/encryption in your requests