Taxamo

The Membership 2 Taxamo class.

Defined (1)

The class is defined in the following location(s).

/lib/taxamo/Taxamo.php  
  1. class Taxamo { 
  2.  
  3. function __construct($apiClient) { 
  4. $this->apiClient = $apiClient; 
  5.  
  6. /** 
  7. * createRefund 
  8. * Create a refund 
  9. * key, string: Transaction key. (required) 
  10.   
  11. * body, createRefundIn: Input (required) 
  12.   
  13. * @return createRefundOut 
  14. */ 
  15.  
  16. public function createRefund($key, $body) { 
  17.  
  18. //parse inputs 
  19. $resourcePath = "/api/v1/transactions/{key}/refunds"; 
  20. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  21. $method = "POST"; 
  22. $queryParams = array(); 
  23. $headerParams = array(); 
  24. $headerParams['Accept'] = 'application/json'; 
  25. $headerParams['Content-Type'] = 'application/json'; 
  26.  
  27. if($key != null) { 
  28. $resourcePath = str_replace("{" . "key" . "}",  
  29. $this->apiClient->toPathValue($key), $resourcePath); 
  30. //make the API Call 
  31. if (! isset($body)) { 
  32. $body = null; 
  33. $response = $this->apiClient->callAPI($resourcePath, $method,  
  34. $queryParams, $body,  
  35. $headerParams); 
  36.  
  37.  
  38. if(! $response) { 
  39. return null; 
  40.  
  41. $responseObject = $this->apiClient->deserialize($response,  
  42. 'createRefundOut'); 
  43. return $responseObject; 
  44.  
  45. /** 
  46. * createPayment 
  47. * Register a payment 
  48. * key, string: Transaction key. (required) 
  49.   
  50. * body, createPaymentIn: Input (required) 
  51.   
  52. * @return createPaymentOut 
  53. */ 
  54.  
  55. public function createPayment($key, $body) { 
  56.  
  57. //parse inputs 
  58. $resourcePath = "/api/v1/transactions/{key}/payments"; 
  59. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  60. $method = "POST"; 
  61. $queryParams = array(); 
  62. $headerParams = array(); 
  63. $headerParams['Accept'] = 'application/json'; 
  64. $headerParams['Content-Type'] = 'application/json'; 
  65.  
  66. if($key != null) { 
  67. $resourcePath = str_replace("{" . "key" . "}",  
  68. $this->apiClient->toPathValue($key), $resourcePath); 
  69. //make the API Call 
  70. if (! isset($body)) { 
  71. $body = null; 
  72. $response = $this->apiClient->callAPI($resourcePath, $method,  
  73. $queryParams, $body,  
  74. $headerParams); 
  75.  
  76.  
  77. if(! $response) { 
  78. return null; 
  79.  
  80. $responseObject = $this->apiClient->deserialize($response,  
  81. 'createPaymentOut'); 
  82. return $responseObject; 
  83.  
  84. /** 
  85. * listPayments 
  86. * List payments 
  87. * limit, string: Max record count (no more than 100, defaults to 10). (optional) 
  88.   
  89. * offset, string: How many records need to be skipped, defaults to 0. (optional) 
  90.   
  91. * key, string: Transaction key. (required) 
  92.   
  93. * @return listPaymentsOut 
  94. */ 
  95.  
  96. public function listPayments($limit=null, $offset=null, $key) { 
  97.  
  98. //parse inputs 
  99. $resourcePath = "/api/v1/transactions/{key}/payments"; 
  100. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  101. $method = "GET"; 
  102. $queryParams = array(); 
  103. $headerParams = array(); 
  104. $headerParams['Accept'] = 'application/json'; 
  105. $headerParams['Content-Type'] = 'application/json'; 
  106.  
  107. if($limit != null) { 
  108. $queryParams['limit'] = $this->apiClient->toQueryValue($limit); 
  109. if($offset != null) { 
  110. $queryParams['offset'] = $this->apiClient->toQueryValue($offset); 
  111. if($key != null) { 
  112. $resourcePath = str_replace("{" . "key" . "}",  
  113. $this->apiClient->toPathValue($key), $resourcePath); 
  114. //make the API Call 
  115. if (! isset($body)) { 
  116. $body = null; 
  117. $response = $this->apiClient->callAPI($resourcePath, $method,  
  118. $queryParams, $body,  
  119. $headerParams); 
  120.  
  121.  
  122. if(! $response) { 
  123. return null; 
  124.  
  125. $responseObject = $this->apiClient->deserialize($response,  
  126. 'listPaymentsOut'); 
  127. return $responseObject; 
  128.  
  129.  
  130. /** 
  131. * capturePayment 
  132. * Capture payment 
  133. * key, string: Transaction key. (required) 
  134.   
  135. * @return capturePaymentOut 
  136. */ 
  137.  
  138. public function capturePayment($key) { 
  139.  
  140. //parse inputs 
  141. $resourcePath = "/api/v1/transactions/{key}/payments/capture"; 
  142. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  143. $method = "POST"; 
  144. $queryParams = array(); 
  145. $headerParams = array(); 
  146. $headerParams['Accept'] = 'application/json'; 
  147. $headerParams['Content-Type'] = 'application/json'; 
  148.  
  149. if($key != null) { 
  150. $resourcePath = str_replace("{" . "key" . "}",  
  151. $this->apiClient->toPathValue($key), $resourcePath); 
  152. //make the API Call 
  153. if (! isset($body)) { 
  154. $body = null; 
  155. $response = $this->apiClient->callAPI($resourcePath, $method,  
  156. $queryParams, $body,  
  157. $headerParams); 
  158.  
  159.  
  160. if(! $response) { 
  161. return null; 
  162.  
  163. $responseObject = $this->apiClient->deserialize($response,  
  164. 'capturePaymentOut'); 
  165. return $responseObject; 
  166.  
  167. /** 
  168. * createTransaction 
  169. * Store transaction 
  170. * body, createTransactionIn: Input (required) 
  171.   
  172. * @return createTransactionOut 
  173. */ 
  174.  
  175. public function createTransaction($body) { 
  176.  
  177. //parse inputs 
  178. $resourcePath = "/api/v1/transactions"; 
  179. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  180. $method = "POST"; 
  181. $queryParams = array(); 
  182. $headerParams = array(); 
  183. $headerParams['Accept'] = 'application/json'; 
  184. $headerParams['Content-Type'] = 'application/json'; 
  185.  
  186. //make the API Call 
  187. if (! isset($body)) { 
  188. $body = null; 
  189. $response = $this->apiClient->callAPI($resourcePath, $method,  
  190. $queryParams, $body,  
  191. $headerParams); 
  192.  
  193.  
  194. if(! $response) { 
  195. return null; 
  196.  
  197. $responseObject = $this->apiClient->deserialize($response,  
  198. 'createTransactionOut'); 
  199. return $responseObject; 
  200.  
  201. /** 
  202. * getTransaction 
  203. * Retrieve transaction data. 
  204. * key, string: Transaction key (required) 
  205.   
  206. * @return getTransactionOut 
  207. */ 
  208.  
  209. public function getTransaction($key) { 
  210.  
  211. //parse inputs 
  212. $resourcePath = "/api/v1/transactions/{key}"; 
  213. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  214. $method = "GET"; 
  215. $queryParams = array(); 
  216. $headerParams = array(); 
  217. $headerParams['Accept'] = 'application/json'; 
  218. $headerParams['Content-Type'] = 'application/json'; 
  219.  
  220. if($key != null) { 
  221. $resourcePath = str_replace("{" . "key" . "}",  
  222. $this->apiClient->toPathValue($key), $resourcePath); 
  223. //make the API Call 
  224. if (! isset($body)) { 
  225. $body = null; 
  226. $response = $this->apiClient->callAPI($resourcePath, $method,  
  227. $queryParams, $body,  
  228. $headerParams); 
  229.  
  230.  
  231. if(! $response) { 
  232. return null; 
  233.  
  234. $responseObject = $this->apiClient->deserialize($response,  
  235. 'getTransactionOut'); 
  236. return $responseObject; 
  237.  
  238. /** 
  239. * updateTransaction 
  240. * Update transaction 
  241. * key, string: Transaction key. (optional) 
  242.   
  243. * body, updateTransactionIn: Input (required) 
  244.   
  245. * @return updateTransactionOut 
  246. */ 
  247.  
  248. public function updateTransaction($key=null, $body) { 
  249.  
  250. //parse inputs 
  251. $resourcePath = "/api/v1/transactions/{key}"; 
  252. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  253. $method = "PUT"; 
  254. $queryParams = array(); 
  255. $headerParams = array(); 
  256. $headerParams['Accept'] = 'application/json'; 
  257. $headerParams['Content-Type'] = 'application/json'; 
  258.  
  259. if($key != null) { 
  260. $resourcePath = str_replace("{" . "key" . "}",  
  261. $this->apiClient->toPathValue($key), $resourcePath); 
  262. //make the API Call 
  263. if (! isset($body)) { 
  264. $body = null; 
  265. $response = $this->apiClient->callAPI($resourcePath, $method,  
  266. $queryParams, $body,  
  267. $headerParams); 
  268.  
  269.  
  270. if(! $response) { 
  271. return null; 
  272.  
  273. $responseObject = $this->apiClient->deserialize($response,  
  274. 'updateTransactionOut'); 
  275. return $responseObject; 
  276.  
  277. /** 
  278. * confirmTransaction 
  279. * Confirm transaction 
  280. * key, string: Transaction key. (optional) 
  281.   
  282. * body, confirmTransactionIn: Input (required) 
  283.   
  284. * @return confirmTransactionOut 
  285. */ 
  286.  
  287. public function confirmTransaction($key=null, $body) { 
  288.  
  289. //parse inputs 
  290. $resourcePath = "/api/v1/transactions/{key}/confirm"; 
  291. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  292. $method = "POST"; 
  293. $queryParams = array(); 
  294. $headerParams = array(); 
  295. $headerParams['Accept'] = 'application/json'; 
  296. $headerParams['Content-Type'] = 'application/json'; 
  297.  
  298. if($key != null) { 
  299. $resourcePath = str_replace("{" . "key" . "}",  
  300. $this->apiClient->toPathValue($key), $resourcePath); 
  301. //make the API Call 
  302. if (! isset($body)) { 
  303. $body = null; 
  304. $response = $this->apiClient->callAPI($resourcePath, $method,  
  305. $queryParams, $body,  
  306. $headerParams); 
  307.  
  308.  
  309. if(! $response) { 
  310. return null; 
  311.  
  312. $responseObject = $this->apiClient->deserialize($response,  
  313. 'confirmTransactionOut'); 
  314. return $responseObject; 
  315.  
  316. /** 
  317. * cancelTransaction 
  318. * Delete transaction 
  319. * key, string: Transaction key (optional) 
  320.   
  321. * @return cancelTransactionOut 
  322. */ 
  323.  
  324. public function cancelTransaction($key=null) { 
  325.  
  326. //parse inputs 
  327. $resourcePath = "/api/v1/transactions/{key}"; 
  328. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  329. $method = "DELETE"; 
  330. $queryParams = array(); 
  331. $headerParams = array(); 
  332. $headerParams['Accept'] = 'application/json'; 
  333. $headerParams['Content-Type'] = 'application/json'; 
  334.  
  335. if($key != null) { 
  336. $resourcePath = str_replace("{" . "key" . "}",  
  337. $this->apiClient->toPathValue($key), $resourcePath); 
  338. //make the API Call 
  339. if (! isset($body)) { 
  340. $body = null; 
  341. $response = $this->apiClient->callAPI($resourcePath, $method,  
  342. $queryParams, $body,  
  343. $headerParams); 
  344.  
  345.  
  346. if(! $response) { 
  347. return null; 
  348.  
  349. $responseObject = $this->apiClient->deserialize($response,  
  350. 'cancelTransactionOut'); 
  351. return $responseObject; 
  352.  
  353. /** 
  354. * listTransactions 
  355. * Browse transactions 
  356. * statuses, string: Comma separated list of of transaction statuses. (optional) 
  357.   
  358. * sort_reverse, bool: If true, results are sorted in descending order. (optional) 
  359.   
  360. * tax_country_code, string: Two letter ISO tax country code. (optional) 
  361.   
  362. * order_date_from, string: Order date from in yyyy-MM-dd format. (optional) 
  363.   
  364. * offset, integer: Offset (optional) 
  365.   
  366. * filter_text, string: Filtering expression (optional) 
  367.   
  368. * format, string: Output format - supports 'csv' value for this operation. (optional) 
  369.   
  370. * order_date_to, string: Order date to in yyyy-MM-dd format. (optional) 
  371.   
  372. * currency_code, string: Three letter ISO currency code. (optional) 
  373.   
  374. * limit, integer: Limit (optional) 
  375.   
  376. * @return listTransactionsOut 
  377. */ 
  378.  
  379. public function listTransactions($statuses=null, $sort_reverse=null, $tax_country_code=null, $order_date_from=null, $offset=null, $filter_text=null, $format=null, $order_date_to=null, $currency_code=null, $limit=null) { 
  380.  
  381. //parse inputs 
  382. $resourcePath = "/api/v1/transactions"; 
  383. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  384. $method = "GET"; 
  385. $queryParams = array(); 
  386. $headerParams = array(); 
  387. $headerParams['Accept'] = 'application/json'; 
  388. $headerParams['Content-Type'] = 'application/json'; 
  389.  
  390. if($statuses != null) { 
  391. $queryParams['statuses'] = $this->apiClient->toQueryValue($statuses); 
  392. if($sort_reverse != null) { 
  393. $queryParams['sort_reverse'] = $this->apiClient->toQueryValue($sort_reverse); 
  394. if($tax_country_code != null) { 
  395. $queryParams['tax_country_code'] = $this->apiClient->toQueryValue($tax_country_code); 
  396. if($order_date_from != null) { 
  397. $queryParams['order_date_from'] = $this->apiClient->toQueryValue($order_date_from); 
  398. if($offset != null) { 
  399. $queryParams['offset'] = $this->apiClient->toQueryValue($offset); 
  400. if($filter_text != null) { 
  401. $queryParams['filter_text'] = $this->apiClient->toQueryValue($filter_text); 
  402. if($format != null) { 
  403. $queryParams['format'] = $this->apiClient->toQueryValue($format); 
  404. if($order_date_to != null) { 
  405. $queryParams['order_date_to'] = $this->apiClient->toQueryValue($order_date_to); 
  406. if($currency_code != null) { 
  407. $queryParams['currency_code'] = $this->apiClient->toQueryValue($currency_code); 
  408. if($limit != null) { 
  409. $queryParams['limit'] = $this->apiClient->toQueryValue($limit); 
  410. //make the API Call 
  411. if (! isset($body)) { 
  412. $body = null; 
  413. $response = $this->apiClient->callAPI($resourcePath, $method,  
  414. $queryParams, $body,  
  415. $headerParams); 
  416.  
  417.  
  418. if(! $response) { 
  419. return null; 
  420.  
  421. $responseObject = $this->apiClient->deserialize($response,  
  422. 'listTransactionsOut'); 
  423. return $responseObject; 
  424.  
  425. /** 
  426. * calculateTax 
  427. * Calculate tax 
  428. * body, calculateTaxIn: Input (required) 
  429.   
  430. * @return calculateTaxOut 
  431. */ 
  432.  
  433. public function calculateTax($body) { 
  434.  
  435. //parse inputs 
  436. $resourcePath = "/api/v1/tax/calculate"; 
  437. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  438. $method = "POST"; 
  439. $queryParams = array(); 
  440. $headerParams = array(); 
  441. $headerParams['Accept'] = 'application/json'; 
  442. $headerParams['Content-Type'] = 'application/json'; 
  443.  
  444. //make the API Call 
  445. if (! isset($body)) { 
  446. $body = null; 
  447. $response = $this->apiClient->callAPI($resourcePath, $method,  
  448. $queryParams, $body,  
  449. $headerParams); 
  450.  
  451.  
  452. if(! $response) { 
  453. return null; 
  454.  
  455. $responseObject = $this->apiClient->deserialize($response,  
  456. 'calculateTaxOut'); 
  457. return $responseObject; 
  458.  
  459. /** 
  460. * calculateSimpleTax 
  461. * Simple tax 
  462. * buyer_credit_card_prefix, string: Buyer's credit card prefix. (optional) 
  463.   
  464. * buyer_tax_number, string: Buyer's tax number - EU VAT number for example. If using EU VAT number, it is possible to provide country code in it (e.g. IE1234567X) or simply use billing_country_code field for that. In the first case, if billing_country_code value was provided, it will be overwritten with country code value extracted from VAT number - but only if the VAT has been verified properly. (optional) 
  465.   
  466. * product_type, string: Product type, according to dictionary /dictionaries/product_types. (optional) 
  467.   
  468. * force_country_code, string: Two-letter ISO country code, e.g. FR. Use it to force country code for tax calculation. (optional) 
  469.   
  470. * quantity, number: Quantity Defaults to 1. (optional) 
  471.   
  472. * unit_price, number: Unit price. (optional) 
  473.   
  474. * total_amount, number: Total amount. Required if amount is not provided. (optional) 
  475.   
  476. * tax_deducted, bool: True if the transaction deducted from tax and no tax is applied. Either set automatically when VAT number validates with VIES correctly, but can also be provided in manual mode. (optional) 
  477.   
  478. * amount, number: Amount. Required if total amount is not provided. (optional) 
  479.   
  480. * billing_country_code, string: Billing two letter ISO country code. (optional) 
  481.   
  482. * currency_code, string: Currency code for transaction - e.g. EUR. (required) 
  483.   
  484. * order_date, string: Order date in yyyy-MM-dd format, in merchant's timezone. If provided by the API caller, no timezone conversion is performed. 
  485. Default value is current date and time. When using public token, the default value is used. (optional) 
  486.   
  487. * @return calculateSimpleTaxOut 
  488. */ 
  489.  
  490. public function calculateSimpleTax($buyer_credit_card_prefix=null, $buyer_tax_number=null, $product_type=null, $force_country_code=null, $quantity=null, $unit_price=null, $total_amount=null, $tax_deducted=null, $amount=null, $billing_country_code=null, $currency_code, $order_date=null) { 
  491.  
  492. //parse inputs 
  493. $resourcePath = "/api/v1/tax/calculate"; 
  494. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  495. $method = "GET"; 
  496. $queryParams = array(); 
  497. $headerParams = array(); 
  498. $headerParams['Accept'] = 'application/json'; 
  499. $headerParams['Content-Type'] = 'application/json'; 
  500.  
  501. if($buyer_credit_card_prefix != null) { 
  502. $queryParams['buyer_credit_card_prefix'] = $this->apiClient->toQueryValue($buyer_credit_card_prefix); 
  503. if($buyer_tax_number != null) { 
  504. $queryParams['buyer_tax_number'] = $this->apiClient->toQueryValue($buyer_tax_number); 
  505. if($product_type != null) { 
  506. $queryParams['product_type'] = $this->apiClient->toQueryValue($product_type); 
  507. if($force_country_code != null) { 
  508. $queryParams['force_country_code'] = $this->apiClient->toQueryValue($force_country_code); 
  509. if($quantity != null) { 
  510. $queryParams['quantity'] = $this->apiClient->toQueryValue($quantity); 
  511. if($unit_price != null) { 
  512. $queryParams['unit_price'] = $this->apiClient->toQueryValue($unit_price); 
  513. if($total_amount != null) { 
  514. $queryParams['total_amount'] = $this->apiClient->toQueryValue($total_amount); 
  515. if($tax_deducted != null) { 
  516. $queryParams['tax_deducted'] = $this->apiClient->toQueryValue($tax_deducted); 
  517. if($amount != null) { 
  518. $queryParams['amount'] = $this->apiClient->toQueryValue($amount); 
  519. if($billing_country_code != null) { 
  520. $queryParams['billing_country_code'] = $this->apiClient->toQueryValue($billing_country_code); 
  521. if($currency_code != null) { 
  522. $queryParams['currency_code'] = $this->apiClient->toQueryValue($currency_code); 
  523. if($order_date != null) { 
  524. $queryParams['order_date'] = $this->apiClient->toQueryValue($order_date); 
  525. //make the API Call 
  526. if (! isset($body)) { 
  527. $body = null; 
  528. $response = $this->apiClient->callAPI($resourcePath, $method,  
  529. $queryParams, $body,  
  530. $headerParams); 
  531.  
  532.  
  533. if(! $response) { 
  534. return null; 
  535.  
  536. $responseObject = $this->apiClient->deserialize($response,  
  537. 'calculateSimpleTaxOut'); 
  538. return $responseObject; 
  539.  
  540. /** 
  541. * validateTaxNumber 
  542. * Validate VAT number 
  543. * country_code, string: Two-letter ISO country code. (optional) 
  544.   
  545. * tax_number, string: Tax number (required) 
  546.   
  547. * @return validateTaxNumberOut 
  548. */ 
  549.  
  550. public function validateTaxNumber($country_code=null, $tax_number) { 
  551.  
  552. //parse inputs 
  553. $resourcePath = "/api/v1/tax/vat_numbers/{tax_number}/validate"; 
  554. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  555. $method = "GET"; 
  556. $queryParams = array(); 
  557. $headerParams = array(); 
  558. $headerParams['Accept'] = 'application/json'; 
  559. $headerParams['Content-Type'] = 'application/json'; 
  560.  
  561. if($country_code != null) { 
  562. $queryParams['country_code'] = $this->apiClient->toQueryValue($country_code); 
  563. if($tax_number != null) { 
  564. $resourcePath = str_replace("{" . "tax_number" . "}",  
  565. $this->apiClient->toPathValue($tax_number), $resourcePath); 
  566. //make the API Call 
  567. if (! isset($body)) { 
  568. $body = null; 
  569. $response = $this->apiClient->callAPI($resourcePath, $method,  
  570. $queryParams, $body,  
  571. $headerParams); 
  572.  
  573.  
  574. if(! $response) { 
  575. return null; 
  576.  
  577. $responseObject = $this->apiClient->deserialize($response,  
  578. 'validateTaxNumberOut'); 
  579. return $responseObject; 
  580.  
  581. /** 
  582. * calculateTaxLocation 
  583. * Calculate location 
  584. * billing_country_code, string: Billing two letter ISO country code. (optional) 
  585.   
  586. * buyer_credit_card_prefix, string: Buyer's credit card prefix. (optional) 
  587.   
  588. * @return calculateTaxLocationOut 
  589. */ 
  590.  
  591. public function calculateTaxLocation($billing_country_code=null, $buyer_credit_card_prefix=null) { 
  592.  
  593. //parse inputs 
  594. $resourcePath = "/api/v1/tax/location/calculate"; 
  595. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  596. $method = "GET"; 
  597. $queryParams = array(); 
  598. $headerParams = array(); 
  599. $headerParams['Accept'] = 'application/json'; 
  600. $headerParams['Content-Type'] = 'application/json'; 
  601.  
  602. if($billing_country_code != null) { 
  603. $queryParams['billing_country_code'] = $this->apiClient->toQueryValue($billing_country_code); 
  604. if($buyer_credit_card_prefix != null) { 
  605. $queryParams['buyer_credit_card_prefix'] = $this->apiClient->toQueryValue($buyer_credit_card_prefix); 
  606. //make the API Call 
  607. if (! isset($body)) { 
  608. $body = null; 
  609. $response = $this->apiClient->callAPI($resourcePath, $method,  
  610. $queryParams, $body,  
  611. $headerParams); 
  612.  
  613.  
  614. if(! $response) { 
  615. return null; 
  616.  
  617. $responseObject = $this->apiClient->deserialize($response,  
  618. 'calculateTaxLocationOut'); 
  619. return $responseObject; 
  620.  
  621. /** 
  622. * locateMyIP 
  623. * Locate IP 
  624. * @return locateMyIPOut 
  625. */ 
  626.  
  627. public function locateMyIP() { 
  628.  
  629. //parse inputs 
  630. $resourcePath = "/api/v1/geoip"; 
  631. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  632. $method = "GET"; 
  633. $queryParams = array(); 
  634. $headerParams = array(); 
  635. $headerParams['Accept'] = 'application/json'; 
  636. $headerParams['Content-Type'] = 'application/json'; 
  637.  
  638. //make the API Call 
  639. if (! isset($body)) { 
  640. $body = null; 
  641. $response = $this->apiClient->callAPI($resourcePath, $method,  
  642. $queryParams, $body,  
  643. $headerParams); 
  644.  
  645.  
  646. if(! $response) { 
  647. return null; 
  648.  
  649. $responseObject = $this->apiClient->deserialize($response,  
  650. 'locateMyIPOut'); 
  651. return $responseObject; 
  652.  
  653. /** 
  654. * locateGivenIP 
  655. * Locate provided IP 
  656. * ip, string: IP address. (optional) 
  657.   
  658. * @return locateGivenIPOut 
  659. */ 
  660.  
  661. public function locateGivenIP($ip=null) { 
  662.  
  663. //parse inputs 
  664. $resourcePath = "/api/v1/geoip/{ip}"; 
  665. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  666. $method = "GET"; 
  667. $queryParams = array(); 
  668. $headerParams = array(); 
  669. $headerParams['Accept'] = 'application/json'; 
  670. $headerParams['Content-Type'] = 'application/json'; 
  671.  
  672. if($ip != null) { 
  673. $resourcePath = str_replace("{" . "ip" . "}",  
  674. $this->apiClient->toPathValue($ip), $resourcePath); 
  675. //make the API Call 
  676. if (! isset($body)) { 
  677. $body = null; 
  678. $response = $this->apiClient->callAPI($resourcePath, $method,  
  679. $queryParams, $body,  
  680. $headerParams); 
  681.  
  682.  
  683. if(! $response) { 
  684. return null; 
  685.  
  686. $responseObject = $this->apiClient->deserialize($response,  
  687. 'locateGivenIPOut'); 
  688. return $responseObject; 
  689.  
  690. /** 
  691. * getTransactionsStats 
  692. * Transaction stats 
  693. * date_from, string: Date from in yyyy-MM format. (required) 
  694.   
  695. * date_to, string: Date to in yyyy-MM format. (required) 
  696.   
  697. * interval, string: Interval. Accepted values are 'day', 'week' and 'month'. (optional) 
  698.   
  699. * @return getTransactionsStatsOut 
  700. */ 
  701.  
  702. public function getTransactionsStats($date_from, $date_to, $interval=null) { 
  703.  
  704. //parse inputs 
  705. $resourcePath = "/api/v1/stats/transactions"; 
  706. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  707. $method = "GET"; 
  708. $queryParams = array(); 
  709. $headerParams = array(); 
  710. $headerParams['Accept'] = 'application/json'; 
  711. $headerParams['Content-Type'] = 'application/json'; 
  712.  
  713. if($date_from != null) { 
  714. $queryParams['date_from'] = $this->apiClient->toQueryValue($date_from); 
  715. if($date_to != null) { 
  716. $queryParams['date_to'] = $this->apiClient->toQueryValue($date_to); 
  717. if($interval != null) { 
  718. $queryParams['interval'] = $this->apiClient->toQueryValue($interval); 
  719. //make the API Call 
  720. if (! isset($body)) { 
  721. $body = null; 
  722. $response = $this->apiClient->callAPI($resourcePath, $method,  
  723. $queryParams, $body,  
  724. $headerParams); 
  725.  
  726.  
  727. if(! $response) { 
  728. return null; 
  729.  
  730. $responseObject = $this->apiClient->deserialize($response,  
  731. 'getTransactionsStatsOut'); 
  732. return $responseObject; 
  733.  
  734. /** 
  735. * getSettlementStatsByCountry 
  736. * Settlement stats per country 
  737. * date_from, string: Date from in yyyy-MM format. (required) 
  738.   
  739. * date_to, string: Date to in yyyy-MM format. (required) 
  740.   
  741. * @return getSettlementStatsByCountryOut 
  742. */ 
  743.  
  744. public function getSettlementStatsByCountry($date_from, $date_to) { 
  745.  
  746. //parse inputs 
  747. $resourcePath = "/api/v1/stats/settlement/by_country"; 
  748. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  749. $method = "GET"; 
  750. $queryParams = array(); 
  751. $headerParams = array(); 
  752. $headerParams['Accept'] = 'application/json'; 
  753. $headerParams['Content-Type'] = 'application/json'; 
  754.  
  755. if($date_from != null) { 
  756. $queryParams['date_from'] = $this->apiClient->toQueryValue($date_from); 
  757. if($date_to != null) { 
  758. $queryParams['date_to'] = $this->apiClient->toQueryValue($date_to); 
  759. //make the API Call 
  760. if (! isset($body)) { 
  761. $body = null; 
  762. $response = $this->apiClient->callAPI($resourcePath, $method,  
  763. $queryParams, $body,  
  764. $headerParams); 
  765.  
  766.  
  767. if(! $response) { 
  768. return null; 
  769.  
  770. $responseObject = $this->apiClient->deserialize($response,  
  771. 'getSettlementStatsByCountryOut'); 
  772. return $responseObject; 
  773.  
  774. /** 
  775. * getSettlementStatsByTaxationType 
  776. * Settlement stats per taxation type 
  777. * date_from, string: Date from in yyyy-MM format. (required) 
  778.   
  779. * date_to, string: Date to in yyyy-MM format. (required) 
  780.   
  781. * @return getSettlementStatsByTaxationTypeOut 
  782. */ 
  783.  
  784. public function getSettlementStatsByTaxationType($date_from, $date_to) { 
  785.  
  786. //parse inputs 
  787. $resourcePath = "/api/v1/stats/settlement/by_taxation_type"; 
  788. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  789. $method = "GET"; 
  790. $queryParams = array(); 
  791. $headerParams = array(); 
  792. $headerParams['Accept'] = 'application/json'; 
  793. $headerParams['Content-Type'] = 'application/json'; 
  794.  
  795. if($date_from != null) { 
  796. $queryParams['date_from'] = $this->apiClient->toQueryValue($date_from); 
  797. if($date_to != null) { 
  798. $queryParams['date_to'] = $this->apiClient->toQueryValue($date_to); 
  799. //make the API Call 
  800. if (! isset($body)) { 
  801. $body = null; 
  802. $response = $this->apiClient->callAPI($resourcePath, $method,  
  803. $queryParams, $body,  
  804. $headerParams); 
  805.  
  806.  
  807. if(! $response) { 
  808. return null; 
  809.  
  810. $responseObject = $this->apiClient->deserialize($response,  
  811. 'getSettlementStatsByTaxationTypeOut'); 
  812. return $responseObject; 
  813.  
  814. /** 
  815. * getDailySettlementStats 
  816. * Settlement stats over time 
  817. * interval, string: Interval type - day, week, month. (required) 
  818.   
  819. * date_from, string: Date from in yyyy-MM format. (required) 
  820.   
  821. * date_to, string: Date to in yyyy-MM format. (required) 
  822.   
  823. * @return getDailySettlementStatsOut 
  824. */ 
  825.  
  826. public function getDailySettlementStats($interval, $date_from, $date_to) { 
  827.  
  828. //parse inputs 
  829. $resourcePath = "/api/v1/stats/settlement/daily"; 
  830. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  831. $method = "GET"; 
  832. $queryParams = array(); 
  833. $headerParams = array(); 
  834. $headerParams['Accept'] = 'application/json'; 
  835. $headerParams['Content-Type'] = 'application/json'; 
  836.  
  837. if($interval != null) { 
  838. $queryParams['interval'] = $this->apiClient->toQueryValue($interval); 
  839. if($date_from != null) { 
  840. $queryParams['date_from'] = $this->apiClient->toQueryValue($date_from); 
  841. if($date_to != null) { 
  842. $queryParams['date_to'] = $this->apiClient->toQueryValue($date_to); 
  843. //make the API Call 
  844. if (! isset($body)) { 
  845. $body = null; 
  846. $response = $this->apiClient->callAPI($resourcePath, $method,  
  847. $queryParams, $body,  
  848. $headerParams); 
  849.  
  850.  
  851. if(! $response) { 
  852. return null; 
  853.  
  854. $responseObject = $this->apiClient->deserialize($response,  
  855. 'getDailySettlementStatsOut'); 
  856. return $responseObject; 
  857.  
  858. /** 
  859. * getRefunds 
  860. * Fetch refunds 
  861. * moss_country_code, string: MOSS country code, used to determine currency. If ommited, merchant default setting is used. (optional) 
  862.   
  863. * date_from, string: Take only refunds issued at or after the date. Format: yyyy-MM-dd (optional) 
  864.   
  865. * @return getRefundsOut 
  866. */ 
  867.  
  868. public function getRefunds($moss_country_code=null, $date_from=null) { 
  869.  
  870. //parse inputs 
  871. $resourcePath = "/api/v1/settlement/refunds"; 
  872. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  873. $method = "GET"; 
  874. $queryParams = array(); 
  875. $headerParams = array(); 
  876. $headerParams['Accept'] = 'application/json'; 
  877. $headerParams['Content-Type'] = 'application/json'; 
  878.  
  879. if($moss_country_code != null) { 
  880. $queryParams['moss_country_code'] = $this->apiClient->toQueryValue($moss_country_code); 
  881. if($date_from != null) { 
  882. $queryParams['date_from'] = $this->apiClient->toQueryValue($date_from); 
  883. //make the API Call 
  884. if (! isset($body)) { 
  885. $body = null; 
  886. $response = $this->apiClient->callAPI($resourcePath, $method,  
  887. $queryParams, $body,  
  888. $headerParams); 
  889.  
  890.  
  891. if(! $response) { 
  892. return null; 
  893.  
  894. $responseObject = $this->apiClient->deserialize($response,  
  895. 'getRefundsOut'); 
  896. return $responseObject; 
  897.  
  898. /** 
  899. * getSettlement 
  900. * Fetch settlement 
  901. * format, string: Output format. 'csv' value is accepted as well (optional) 
  902.   
  903. * moss_country_code, string: MOSS country code, used to determine currency. If ommited, merchant default setting is used. (optional) 
  904.   
  905. * quarter, string: Quarter in yyyy-MM format. (required) 
  906.   
  907. * @return getSettlementOut 
  908. */ 
  909.  
  910. public function getSettlement($format=null, $moss_country_code=null, $quarter) { 
  911.  
  912. //parse inputs 
  913. $resourcePath = "/api/v1/settlement/{quarter}"; 
  914. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  915. $method = "GET"; 
  916. $queryParams = array(); 
  917. $headerParams = array(); 
  918. $headerParams['Accept'] = 'application/json'; 
  919. $headerParams['Content-Type'] = 'application/json'; 
  920.  
  921. if($format != null) { 
  922. $queryParams['format'] = $this->apiClient->toQueryValue($format); 
  923. if($moss_country_code != null) { 
  924. $queryParams['moss_country_code'] = $this->apiClient->toQueryValue($moss_country_code); 
  925. if($quarter != null) { 
  926. $resourcePath = str_replace("{" . "quarter" . "}",  
  927. $this->apiClient->toPathValue($quarter), $resourcePath); 
  928. //make the API Call 
  929. if (! isset($body)) { 
  930. $body = null; 
  931. $response = $this->apiClient->callAPI($resourcePath, $method,  
  932. $queryParams, $body,  
  933. $headerParams); 
  934.  
  935.  
  936. if(! $response) { 
  937. return null; 
  938.  
  939. $responseObject = $this->apiClient->deserialize($response,  
  940. 'getSettlementOut'); 
  941. return $responseObject; 
  942.  
  943. /** 
  944. * getSettlementSummary 
  945. * Fetch settlement summary 
  946. * moss_country_code, string: MOSS country code, used to determine currency. If ommited, merchant default setting is used. (optional) 
  947.   
  948. * quarter, string: Quarter in yyyy-MM format. (required) 
  949.   
  950. * @return getSettlementSummaryOut 
  951. */ 
  952.  
  953. public function getSettlementSummary($moss_country_code=null, $quarter) { 
  954.  
  955. //parse inputs 
  956. $resourcePath = "/api/v1/settlement/summary/{quarter}"; 
  957. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  958. $method = "GET"; 
  959. $queryParams = array(); 
  960. $headerParams = array(); 
  961. $headerParams['Accept'] = 'application/json'; 
  962. $headerParams['Content-Type'] = 'application/json'; 
  963.  
  964. if($moss_country_code != null) { 
  965. $queryParams['moss_country_code'] = $this->apiClient->toQueryValue($moss_country_code); 
  966. if($quarter != null) { 
  967. $resourcePath = str_replace("{" . "quarter" . "}",  
  968. $this->apiClient->toPathValue($quarter), $resourcePath); 
  969. //make the API Call 
  970. if (! isset($body)) { 
  971. $body = null; 
  972. $response = $this->apiClient->callAPI($resourcePath, $method,  
  973. $queryParams, $body,  
  974. $headerParams); 
  975.  
  976.  
  977. if(! $response) { 
  978. return null; 
  979.  
  980. $responseObject = $this->apiClient->deserialize($response,  
  981. 'getSettlementSummaryOut'); 
  982. return $responseObject; 
  983.  
  984. /** 
  985. * createSMSToken 
  986. * Create SMS token 
  987. * body, createSMSTokenIn: Input (required) 
  988.   
  989. * @return createSMSTokenOut 
  990. */ 
  991.  
  992. public function createSMSToken($body) { 
  993.  
  994. //parse inputs 
  995. $resourcePath = "/api/v1/verification/sms"; 
  996. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  997. $method = "POST"; 
  998. $queryParams = array(); 
  999. $headerParams = array(); 
  1000. $headerParams['Accept'] = 'application/json'; 
  1001. $headerParams['Content-Type'] = 'application/json'; 
  1002.  
  1003. //make the API Call 
  1004. if (! isset($body)) { 
  1005. $body = null; 
  1006. $response = $this->apiClient->callAPI($resourcePath, $method,  
  1007. $queryParams, $body,  
  1008. $headerParams); 
  1009.  
  1010.  
  1011. if(! $response) { 
  1012. return null; 
  1013.  
  1014. $responseObject = $this->apiClient->deserialize($response,  
  1015. 'createSMSTokenOut'); 
  1016. return $responseObject; 
  1017.  
  1018. /** 
  1019. * verifySMSToken 
  1020. * Verify SMS token 
  1021. * token, string: Provided token. (required) 
  1022.   
  1023. * @return verifySMSTokenOut 
  1024. */ 
  1025.  
  1026. public function verifySMSToken($token) { 
  1027.  
  1028. //parse inputs 
  1029. $resourcePath = "/api/v1/verification/sms/{token}"; 
  1030. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  1031. $method = "GET"; 
  1032. $queryParams = array(); 
  1033. $headerParams = array(); 
  1034. $headerParams['Accept'] = 'application/json'; 
  1035. $headerParams['Content-Type'] = 'application/json'; 
  1036.  
  1037. if($token != null) { 
  1038. $resourcePath = str_replace("{" . "token" . "}",  
  1039. $this->apiClient->toPathValue($token), $resourcePath); 
  1040. //make the API Call 
  1041. if (! isset($body)) { 
  1042. $body = null; 
  1043. $response = $this->apiClient->callAPI($resourcePath, $method,  
  1044. $queryParams, $body,  
  1045. $headerParams); 
  1046.  
  1047.  
  1048. if(! $response) { 
  1049. return null; 
  1050.  
  1051. $responseObject = $this->apiClient->deserialize($response,  
  1052. 'verifySMSTokenOut'); 
  1053. return $responseObject; 
  1054.  
  1055. /** 
  1056. * getCurrenciesDict 
  1057. * Currencies 
  1058. * @return getCurrenciesDictOut 
  1059. */ 
  1060.  
  1061. public function getCurrenciesDict() { 
  1062.  
  1063. //parse inputs 
  1064. $resourcePath = "/api/v1/dictionaries/currencies"; 
  1065. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  1066. $method = "GET"; 
  1067. $queryParams = array(); 
  1068. $headerParams = array(); 
  1069. $headerParams['Accept'] = 'application/json'; 
  1070. $headerParams['Content-Type'] = 'application/json'; 
  1071.  
  1072. //make the API Call 
  1073. if (! isset($body)) { 
  1074. $body = null; 
  1075. $response = $this->apiClient->callAPI($resourcePath, $method,  
  1076. $queryParams, $body,  
  1077. $headerParams); 
  1078.  
  1079.  
  1080. if(! $response) { 
  1081. return null; 
  1082.  
  1083. $responseObject = $this->apiClient->deserialize($response,  
  1084. 'getCurrenciesDictOut'); 
  1085. return $responseObject; 
  1086.  
  1087. /** 
  1088. * getProductTypesDict 
  1089. * Product types 
  1090. * @return getProductTypesDictOut 
  1091. */ 
  1092.  
  1093. public function getProductTypesDict() { 
  1094.  
  1095. //parse inputs 
  1096. $resourcePath = "/api/v1/dictionaries/product_types"; 
  1097. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  1098. $method = "GET"; 
  1099. $queryParams = array(); 
  1100. $headerParams = array(); 
  1101. $headerParams['Accept'] = 'application/json'; 
  1102. $headerParams['Content-Type'] = 'application/json'; 
  1103.  
  1104. //make the API Call 
  1105. if (! isset($body)) { 
  1106. $body = null; 
  1107. $response = $this->apiClient->callAPI($resourcePath, $method,  
  1108. $queryParams, $body,  
  1109. $headerParams); 
  1110.  
  1111.  
  1112. if(! $response) { 
  1113. return null; 
  1114.  
  1115. $responseObject = $this->apiClient->deserialize($response,  
  1116. 'getProductTypesDictOut'); 
  1117. return $responseObject; 
  1118.  
  1119. /** 
  1120. * getCountriesDict 
  1121. * Countries 
  1122. * tax_supported, bool: Should only countries with tax supported be listed? (optional) 
  1123.   
  1124. * @return getCountriesDictOut 
  1125. */ 
  1126.  
  1127. public function getCountriesDict($tax_supported=null) { 
  1128.  
  1129. //parse inputs 
  1130. $resourcePath = "/api/v1/dictionaries/countries"; 
  1131. $resourcePath = str_replace("{format}", "json", $resourcePath); 
  1132. $method = "GET"; 
  1133. $queryParams = array(); 
  1134. $headerParams = array(); 
  1135. $headerParams['Accept'] = 'application/json'; 
  1136. $headerParams['Content-Type'] = 'application/json'; 
  1137.  
  1138. if($tax_supported != null) { 
  1139. $queryParams['tax_supported'] = $this->apiClient->toQueryValue($tax_supported); 
  1140. //make the API Call 
  1141. if (! isset($body)) { 
  1142. $body = null; 
  1143. $response = $this->apiClient->callAPI($resourcePath, $method,  
  1144. $queryParams, $body,  
  1145. $headerParams); 
  1146.  
  1147.  
  1148. if(! $response) { 
  1149. return null; 
  1150.  
  1151. $responseObject = $this->apiClient->deserialize($response,  
  1152. 'getCountriesDictOut'); 
  1153. return $responseObject; 
  1154.  
  1155.  
  1156.