|
@@ 21-28 (lines=8) @@
|
| 18 |
|
const TTL_SEC_MIN = 300; |
| 19 |
|
const TTL_SEC_MAX = 1800; |
| 20 |
|
|
| 21 |
|
public static function checkCartItemName(string $name) |
| 22 |
|
{ |
| 23 |
|
self::checkWhitespaces($name); |
| 24 |
|
|
| 25 |
|
if (strlen(utf8_decode($name)) > self::CART_ITEM_NAME_LENGTH_MAX) { |
| 26 |
|
throw new \InvalidArgumentException(sprintf('Cart item name can have maximum of %d characters.', self::CART_ITEM_NAME_LENGTH_MAX)); |
| 27 |
|
} |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public static function checkCartItemDescription(string $description) |
| 31 |
|
{ |
|
@@ 30-37 (lines=8) @@
|
| 27 |
|
} |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public static function checkCartItemDescription(string $description) |
| 31 |
|
{ |
| 32 |
|
self::checkWhitespaces($description); |
| 33 |
|
|
| 34 |
|
if (strlen(utf8_decode($description)) > self::CART_ITEM_DESCRIPTION_LENGTH_MAX) { |
| 35 |
|
throw new \InvalidArgumentException(sprintf('Cart item description can have maximum of %d characters.', self::CART_ITEM_DESCRIPTION_LENGTH_MAX)); |
| 36 |
|
} |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
public static function checkCartItemQuantity(int $quantity) |
| 40 |
|
{ |
|
@@ 66-73 (lines=8) @@
|
| 63 |
|
|
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public static function checkReturnUrl(string $returnUrl) |
| 67 |
|
{ |
| 68 |
|
self::checkWhitespaces($returnUrl); |
| 69 |
|
|
| 70 |
|
if (strlen(utf8_decode($returnUrl)) > self::RETURN_URL_LENGTH_MAX) { |
| 71 |
|
throw new \InvalidArgumentException(sprintf('ReturnUrl can have maximum of %d characters.', self::RETURN_URL_LENGTH_MAX)); |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
public static function checkDescription(string $description) |
| 76 |
|
{ |
|
@@ 75-82 (lines=8) @@
|
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
public static function checkDescription(string $description) |
| 76 |
|
{ |
| 77 |
|
self::checkWhitespaces($description); |
| 78 |
|
|
| 79 |
|
if (strlen(utf8_decode($description)) > self::DESCRIPTION_LENGTH_MAX) { |
| 80 |
|
throw new \InvalidArgumentException(sprintf('Description can have maximum of %d characters.', self::DESCRIPTION_LENGTH_MAX)); |
| 81 |
|
} |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
public static function checkMerchantData(string $merchantData) |
| 85 |
|
{ |
|
@@ 84-91 (lines=8) @@
|
| 81 |
|
} |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
public static function checkMerchantData(string $merchantData) |
| 85 |
|
{ |
| 86 |
|
self::checkWhitespaces($merchantData); |
| 87 |
|
|
| 88 |
|
if (strlen(utf8_decode(base64_encode($merchantData))) > self::MERCHANT_DATA_LENGTH_MAX) { |
| 89 |
|
throw new \InvalidArgumentException(sprintf('MerchantData can have maximum of %d characters in encoded state.', self::MERCHANT_DATA_LENGTH_MAX)); |
| 90 |
|
} |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public static function checkCustomerId(string $customerId) |
| 94 |
|
{ |
|
@@ 93-100 (lines=8) @@
|
| 90 |
|
} |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public static function checkCustomerId(string $customerId) |
| 94 |
|
{ |
| 95 |
|
self::checkWhitespaces($customerId); |
| 96 |
|
|
| 97 |
|
if (strlen(utf8_decode($customerId)) > self::CUSTOMER_ID_LENGTH_MAX) { |
| 98 |
|
throw new \InvalidArgumentException(sprintf('CustomerId can have maximum of %d characters.', self::CUSTOMER_ID_LENGTH_MAX)); |
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
public static function checkPayId(string $payId) |
| 103 |
|
{ |
|
@@ 102-109 (lines=8) @@
|
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
public static function checkPayId(string $payId) |
| 103 |
|
{ |
| 104 |
|
self::checkWhitespaces($payId); |
| 105 |
|
|
| 106 |
|
if (strlen(utf8_decode($payId)) > self::PAY_ID_LENGTH_MAX) { |
| 107 |
|
throw new \InvalidArgumentException(sprintf('PayId can have maximum of %d characters.', self::PAY_ID_LENGTH_MAX)); |
| 108 |
|
} |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
private static function checkWhitespaces(string $argument) |
| 112 |
|
{ |