From 5ad0a57da6cb58da546632035e0208e1eb19749e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Th=C3=A2n=20Thi=E1=BB=87n?= Date: Thu, 15 Oct 2020 10:23:12 +0700 Subject: [PATCH 1/5] Fix param type for findAllShopReceipts method https://www.etsy.com/developers/documentation/reference/receipt#method_findallshopreceipts --- src/Etsy/methods.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Etsy/methods.json b/src/Etsy/methods.json index 988fff8..7acc8d5 100644 --- a/src/Etsy/methods.json +++ b/src/Etsy/methods.json @@ -2607,8 +2607,8 @@ "shop_id": "shop_id_or_name", "min_created": "epoch", "max_created": "epoch", - "min_last_modified": "int", - "max_last_modified": "int", + "min_last_modified": "epoch", + "max_last_modified": "epoch", "limit": "int", "offset": "int", "page": "int", From cd56979afc890cea1d721e629e4255aa2ab31b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Th=C3=A2n=20Thi=E1=BB=87n?= Date: Thu, 29 Oct 2020 15:03:52 +0700 Subject: [PATCH 2/5] Add validate for epoch types --- src/Etsy/RequestValidator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Etsy/RequestValidator.php b/src/Etsy/RequestValidator.php index f32277c..61f4306 100644 --- a/src/Etsy/RequestValidator.php +++ b/src/Etsy/RequestValidator.php @@ -110,7 +110,9 @@ public static function validateData($args, $methodInfo) } if ($validType !== $type) { - if (substr($validType, 0, 4) === 'enum') { + if ('epoch' === $validType && false !== strtotime($arg)) { + $result['_valid'][$name] = $arg; + } elseif (substr($validType, 0, 4) === 'enum') { if ($arg === 'enum' || !preg_match("@" . preg_quote($arg) . "@", $validType)) { $result['_invalid'][] = 'Invalid enum data param "' . $name . '" value (' . $arg . '): valid values "' . $validType . '"'; } else { From 45d43944858da351fca35c845253ae85b2752919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Th=C3=A2n=20Thi=E1=BB=87n?= Date: Thu, 29 Oct 2020 15:07:27 +0700 Subject: [PATCH 3/5] Fix implode --- src/Etsy/RequestValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Etsy/RequestValidator.php b/src/Etsy/RequestValidator.php index 61f4306..28ef489 100644 --- a/src/Etsy/RequestValidator.php +++ b/src/Etsy/RequestValidator.php @@ -88,7 +88,7 @@ public static function validateData($args, $methodInfo) { $valueTypes[] = self::transformValueType(gettype($value)); } - $type = 'map(' . implode($valueTypes, ', ') . ')'; + $type = 'map(' . implode(', ', $valueTypes) . ')'; break; } From 2372a79b94118d2f1f977eb2134142b6f1a1b2f0 Mon Sep 17 00:00:00 2001 From: lelinhtinh Date: Mon, 21 Dec 2020 11:18:42 +0700 Subject: [PATCH 4/5] Fixes array(type) --- src/Etsy/EtsyApi.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Etsy/EtsyApi.php b/src/Etsy/EtsyApi.php index 06b8fa7..303e1af 100644 --- a/src/Etsy/EtsyApi.php +++ b/src/Etsy/EtsyApi.php @@ -96,13 +96,18 @@ protected function validateResponse($request_args, $response) private function prepareData($data) { $result = array(); foreach ($data as $key => $value) { - $type = gettype($value); - if ($type !== 'boolean') { - $result[$key] = $value; - continue; - } - - $result[$key] = $value ? 1 : 0; + $type = gettype($value); + switch ($type) { + case 'boolean': + $result[$key] = $value ? 1 : 0; + break; + case 'array': + $result[$key] = implode(',', $value); + break; + default: + $result[$key] = $value; + break; + } } return $result; From dcbc660064ca8aa5e5c49d1117f18bbd04766d63 Mon Sep 17 00:00:00 2001 From: lelinhtinh Date: Tue, 5 Jan 2021 10:17:14 +0700 Subject: [PATCH 5/5] Update when_made validation --- src/Etsy/methods.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Etsy/methods.json b/src/Etsy/methods.json index 7acc8d5..181f5b2 100644 --- a/src/Etsy/methods.json +++ b/src/Etsy/methods.json @@ -471,7 +471,7 @@ "tags": "array(string)", "who_made": "enum(i_did, collective, someone_else)", "is_supply": "boolean", - "when_made": "enum(made_to_order, 2020_2020, 2010_2019, 2001_2009, before_2001, 2000_2000, 1990s, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)", + "when_made": "enum(made_to_order, 2020_2021, 2010_2019, 2002_2009, before_2002, 2000_2001, 1990s, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)", "recipient": "enum(men, women, unisex_adults, teen_boys, teen_girls, teens, boys, girls, children, baby_boys, baby_girls, babies, birds, cats, dogs, pets, not_specified)", "occasion": "enum(anniversary, baptism, bar_or_bat_mitzvah, birthday, canada_day, chinese_new_year, cinco_de_mayo, confirmation, christmas, day_of_the_dead, easter, eid, engagement, fathers_day, get_well, graduation, halloween, hanukkah, housewarming, kwanzaa, prom, july_4th, mothers_day, new_baby, new_years, quinceanera, retirement, st_patricks_day, sweet_16, sympathy, thanksgiving, valentines, wedding)", "style": "array(string)",