From 04d3f9d4ea0f905addc551009e0c3d0db9f8ea7d Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Tue, 8 Mar 2022 17:39:30 +0530 Subject: [PATCH] fix: add whitelist methods for v13 --- shopify_integration/payouts.py | 6 +----- .../doctype/shopify_settings/shopify_settings.py | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/shopify_integration/payouts.py b/shopify_integration/payouts.py index 1380a14..9046fa8 100644 --- a/shopify_integration/payouts.py +++ b/shopify_integration/payouts.py @@ -85,7 +85,6 @@ def create_shopify_payout(shop_name: str, payout_id: str): ] = shopify_settings.get_payout_transactions(payout_id=payout_id) except Exception as e: make_shopify_log( - shop_name=shop_name, status="Payout Transactions Error", response_data=payout.to_dict(), exception=e, @@ -126,9 +125,7 @@ def get_payouts(shopify_settings: "ShopifySettings", start_date: str = str()): try: payouts = shopify_settings.get_payouts(**kwargs) except Exception as e: - make_shopify_log( - shopify_settings.name, status="Payout Error", exception=e, rollback=True - ) + make_shopify_log(status="Payout Error", exception=e, rollback=True) return [] else: return payouts @@ -217,7 +214,6 @@ def _create_shopify_payout(shopify_settings: "ShopifySettings", payout: "Payouts except Exception as e: payout_doc.save(ignore_permissions=True) make_shopify_log( - shopify_settings.name, status="Payout Transactions Error", response_data=payout.to_dict(), exception=e, diff --git a/shopify_integration/shopify_integration/doctype/shopify_settings/shopify_settings.py b/shopify_integration/shopify_integration/doctype/shopify_settings/shopify_settings.py index 1515159..fd526dc 100644 --- a/shopify_integration/shopify_integration/doctype/shopify_settings/shopify_settings.py +++ b/shopify_integration/shopify_integration/doctype/shopify_settings/shopify_settings.py @@ -18,6 +18,7 @@ class ShopifySettings(Document): api_version = "2021-01" @staticmethod + @frappe.whitelist() def get_series(): return { "sales_order_series": frappe.get_meta("Sales Order").get_options("naming_series") or "SO-Shopify-", @@ -79,11 +80,13 @@ def get_variants(self, *args, **kwargs): def get_webhooks(self, *args, **kwargs): return self.get_resources(Webhook, *args, **kwargs) + @frappe.whitelist() def sync_products(self): "Pull and sync products from Shopify, including variants" from shopify_integration.products import sync_items_from_shopify frappe.enqueue(method=sync_items_from_shopify, queue="long", is_async=True, **{"shop_name": self.name}) + @frappe.whitelist() def sync_payouts(self, start_date: str = str()): "Pull and sync payouts from Shopify Payments transactions" from shopify_integration.payouts import create_shopify_payouts