@@ 155-172 (lines=18) @@ | ||
152 | * |
|
153 | * @return $this |
|
154 | */ |
|
155 | public function addIpData($ip = '', $realIp = '', $merchantIp = '') |
|
156 | { |
|
157 | if ($ip !== null && !is_string($ip)) { |
|
158 | throw new \InvalidArgumentException('IP must be string'); |
|
159 | } |
|
160 | if ($realIp !== null && !is_string($realIp)) { |
|
161 | throw new \InvalidArgumentException('Real IP must be string'); |
|
162 | } |
|
163 | if ($merchantIp !== null && !is_string($merchantIp)) { |
|
164 | throw new \InvalidArgumentException('Merchant IP must be string'); |
|
165 | } |
|
166 | ||
167 | $this->replace('ip', $ip); |
|
168 | $this->replace('real_ip', $realIp); |
|
169 | $this->replace('merchant_ip', $merchantIp); |
|
170 | ||
171 | return $this; |
|
172 | } |
|
173 | ||
174 | /** |
|
175 | * Provides browser information for envelope |
|
@@ 581-601 (lines=21) @@ | ||
578 | * |
|
579 | * @return $this |
|
580 | */ |
|
581 | public function addProductData( |
|
582 | $productQuantity = 0.0, |
|
583 | $productName = '', |
|
584 | $productDescription = '' |
|
585 | ) { |
|
586 | if ($productQuantity !== null && !is_int($productQuantity) && !is_float($productQuantity)) { |
|
587 | throw new \InvalidArgumentException('Product quantity must be int or float'); |
|
588 | } |
|
589 | if ($productName !== null && !is_string($productName)) { |
|
590 | throw new \InvalidArgumentException('Product name must be string'); |
|
591 | } |
|
592 | if ($productDescription !== null && !is_string($productDescription)) { |
|
593 | throw new \InvalidArgumentException('Product description must be string'); |
|
594 | } |
|
595 | ||
596 | $this->replace('product_quantity', $productQuantity); |
|
597 | $this->replace('product_name', $productName); |
|
598 | $this->replace('product_description', $productDescription); |
|
599 | ||
600 | return $this; |
|
601 | } |
|
602 | ||
603 | /** |
|
604 | * Adds custom data field to envelope |