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

ConstantValueDescription
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

ConstantValueDescription
SIGNATURE_ALGOOPENSSL_ALGO_SHA256Algorithm used to sign requests.
ENCRYPT_PADDINGOPENSSL_PKCS1_PADDINGRSA encryption padding method.

Status Codes

These constants are returned by API responses and indicate the success or failure of an operation.

ConstantValueDescription
STATUS_SUCCESS0Operation was successful.
STATUS_MISSING_REQ_PARAMS1Required parameters are missing.
STATUS_SIGNATURE_FAILED2Signature verification failed.
STATUS_IPC_ERROR3IPC-specific error occurred.
STATUS_INVALID_SID4Invalid Store ID.
STATUS_INVALID_PARAMS5One or more parameters are invalid.
STATUS_INVALID_REFERER6Invalid referer URL.
STATUS_PAYMENT_TRIES7Maximum payment attempts reached.
STATUS_TRANSACTION_AUTH_FAIL8Transaction authorization failed.
STATUS_WRONG_AMOUNT9Transaction amount is incorrect.
STATUS_UNSUPPORTED_CALL10Unsupported API operation.
STATUS_INACTIVE_MANDATE_REFERENCE11Mandate reference is inactive.
STATUS_INVALID_MANDATE_REFERENCE12Mandate reference is invalid.
STATUS_NOT_SUFFICIENT_FUNDS13Insufficient funds.
STATUS_TRANSACTION_NOT_PERMITTED14Transaction not permitted.
STATUS_EXCEEDED_LIMIT15Transaction limit exceeded.
STATUS_MANDATE_ALREADY_REGISTERED16Mandate already exists.
STATUS_INACTIVE_ACOUNTIDENTIFIER17Account identifier is inactive.
STATUS_INVALID_ACOUNTIDENTIFIER18Invalid account identifier.
STATUS_EXCEEDED_ACCOUNT_LIMITS19Account limits exceeded.
STATUS_DUPLICATE_TRANSMISSION20Duplicate transaction detected.
STATUS_TRANSACTION_DECLINED21Transaction declined.
STATUS_UNDEFINED_ERROR99Unknown 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