@@ 351-368 (lines=18) @@ | ||
348 | * |
|
349 | * @return $this |
|
350 | */ |
|
351 | public function addIpData($ip = '', $realIp = '', $merchantIp = '') |
|
352 | { |
|
353 | if ($ip !== null && !is_string($ip)) { |
|
354 | throw new \InvalidArgumentException('IP must be string'); |
|
355 | } |
|
356 | if ($realIp !== null && !is_string($realIp)) { |
|
357 | throw new \InvalidArgumentException('Real IP must be string'); |
|
358 | } |
|
359 | if ($merchantIp !== null && !is_string($merchantIp)) { |
|
360 | throw new \InvalidArgumentException('Merchant IP must be string'); |
|
361 | } |
|
362 | ||
363 | $this->replace('ip', $ip); |
|
364 | $this->replace('real_ip', $realIp); |
|
365 | $this->replace('merchant_ip', $merchantIp); |
|
366 | ||
367 | return $this; |
|
368 | } |
|
369 | ||
370 | /** |
|
371 | * Provides browser information for envelope |
|
@@ 804-824 (lines=21) @@ | ||
801 | * |
|
802 | * @return $this |
|
803 | */ |
|
804 | public function addProductData( |
|
805 | $productQuantity = 0.0, |
|
806 | $productName = '', |
|
807 | $productDescription = '' |
|
808 | ) { |
|
809 | if ($productQuantity !== null && !is_int($productQuantity) && !is_float($productQuantity)) { |
|
810 | throw new \InvalidArgumentException('Product quantity must be int or float'); |
|
811 | } |
|
812 | if ($productName !== null && !is_string($productName)) { |
|
813 | throw new \InvalidArgumentException('Product name must be string'); |
|
814 | } |
|
815 | if ($productDescription !== null && !is_string($productDescription)) { |
|
816 | throw new \InvalidArgumentException('Product description must be string'); |
|
817 | } |
|
818 | ||
819 | $this->replace('product_quantity', $productQuantity); |
|
820 | $this->replace('product_name', $productName); |
|
821 | $this->replace('product_description', $productDescription); |
|
822 | ||
823 | return $this; |
|
824 | } |
|
825 | ||
826 | /** |
|
827 | * Provides payout information to envelope |