Skip to content

Commit

Permalink
Merge pull request #32 from Alchez/fix-shopify-whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchez authored Mar 9, 2022
2 parents a5f87bf + 04d3f9d commit a51478b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions shopify_integration/payouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a51478b

Please sign in to comment.