Total Complexity | 4 |
Total Lines | 83 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait CatalogProducts |
||
6 | { |
||
7 | /** |
||
8 | * Create a product. |
||
9 | * |
||
10 | * @param array $data |
||
11 | * |
||
12 | * @throws \Throwable |
||
13 | * |
||
14 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
15 | * |
||
16 | * @see https://developer.paypal.com/docs/api/catalog-products/v1/#products_create |
||
17 | */ |
||
18 | public function createProduct(array $data) |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * List products. |
||
31 | * |
||
32 | * @throws \Throwable |
||
33 | * |
||
34 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
35 | * |
||
36 | * @see https://developer.paypal.com/docs/api/catalog-products/v1/#products_list |
||
37 | */ |
||
38 | public function listProducts() |
||
39 | { |
||
40 | $this->apiEndPoint = "v1/catalogs/products?page={$this->current_page}&page_size={$this->page_size}&total_required={$this->show_totals}"; |
||
41 | |||
42 | $this->verb = 'get'; |
||
43 | |||
44 | return $this->doPayPalRequest(); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Update a product. |
||
49 | * |
||
50 | * @param string $product_id |
||
51 | * @param array $data |
||
52 | * |
||
53 | * @throws \Throwable |
||
54 | * |
||
55 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
56 | * |
||
57 | * @see https://developer.paypal.com/docs/api/catalog-products/v1/#products_patch |
||
58 | */ |
||
59 | public function updateProduct(string $product_id, array $data) |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Get product details. |
||
72 | * |
||
73 | * @param string $product_id |
||
74 | * |
||
75 | * @throws \Throwable |
||
76 | * |
||
77 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
78 | * |
||
79 | * @see https://developer.paypal.com/docs/api/catalog-products/v1/#products_get |
||
80 | */ |
||
81 | public function showProductDetails(string $product_id) |
||
90 |