| @@ 258-275 (lines=18) @@ | ||
| 255 | * |
|
| 256 | * @return $this |
|
| 257 | */ |
|
| 258 | public function addIpData($ip = '', $realIp = '', $merchantIp = '') |
|
| 259 | { |
|
| 260 | if ($ip !== null && !is_string($ip)) { |
|
| 261 | throw new \InvalidArgumentException('IP must be string'); |
|
| 262 | } |
|
| 263 | if ($realIp !== null && !is_string($realIp)) { |
|
| 264 | throw new \InvalidArgumentException('Real IP must be string'); |
|
| 265 | } |
|
| 266 | if ($merchantIp !== null && !is_string($merchantIp)) { |
|
| 267 | throw new \InvalidArgumentException('Merchant IP must be string'); |
|
| 268 | } |
|
| 269 | ||
| 270 | $this->replace('ip', $ip); |
|
| 271 | $this->replace('real_ip', $realIp); |
|
| 272 | $this->replace('merchant_ip', $merchantIp); |
|
| 273 | ||
| 274 | return $this; |
|
| 275 | } |
|
| 276 | ||
| 277 | /** |
|
| 278 | * Provides browser information for envelope |
|
| @@ 684-704 (lines=21) @@ | ||
| 681 | * |
|
| 682 | * @return $this |
|
| 683 | */ |
|
| 684 | public function addProductData( |
|
| 685 | $productQuantity = 0.0, |
|
| 686 | $productName = '', |
|
| 687 | $productDescription = '' |
|
| 688 | ) { |
|
| 689 | if ($productQuantity !== null && !is_int($productQuantity) && !is_float($productQuantity)) { |
|
| 690 | throw new \InvalidArgumentException('Product quantity must be int or float'); |
|
| 691 | } |
|
| 692 | if ($productName !== null && !is_string($productName)) { |
|
| 693 | throw new \InvalidArgumentException('Product name must be string'); |
|
| 694 | } |
|
| 695 | if ($productDescription !== null && !is_string($productDescription)) { |
|
| 696 | throw new \InvalidArgumentException('Product description must be string'); |
|
| 697 | } |
|
| 698 | ||
| 699 | $this->replace('product_quantity', $productQuantity); |
|
| 700 | $this->replace('product_name', $productName); |
|
| 701 | $this->replace('product_description', $productDescription); |
|
| 702 | ||
| 703 | return $this; |
|
| 704 | } |
|
| 705 | ||
| 706 | /** |
|
| 707 | * Adds custom data field to envelope |
|