From b68b9eccfce0875a69e018eb154d94fe07361135 Mon Sep 17 00:00:00 2001 From: Bjorn Forsberg Date: Thu, 12 Oct 2023 12:46:03 +0200 Subject: [PATCH 1/2] Handle TaxTransactions + pin SHOPIFY_PARTNER_API_VERSION --- app/models/import/adaptor/shopify_payments_api.rb | 2 +- lib/http_client.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/import/adaptor/shopify_payments_api.rb b/app/models/import/adaptor/shopify_payments_api.rb index 4bbfdb5..6f95270 100644 --- a/app/models/import/adaptor/shopify_payments_api.rb +++ b/app/models/import/adaptor/shopify_payments_api.rb @@ -108,7 +108,7 @@ def payment_date(node) def revenue(node) case node.__typename - when "ReferralAdjustment", "ReferralTransaction" + when "ReferralAdjustment", "ReferralTransaction", "TaxTransaction" node.amount&.amount&.to_f else node.net_amount&.amount&.to_f diff --git a/lib/http_client.rb b/lib/http_client.rb index 6da19af..3c476ec 100644 --- a/lib/http_client.rb +++ b/lib/http_client.rb @@ -1,5 +1,7 @@ module ShopifyPartnerAPI class HTTPClient < GraphQL::Client::HTTP + SHOPIFY_PARTNER_API_VERSION = "2023-10" + def initialize super("https://partners.shopify.com/") end @@ -11,7 +13,7 @@ def headers(context) end def execute(document:, operation_name: nil, variables: {}, context: {}) - @uri = URI.parse("https://partners.shopify.com/#{context.fetch(:organization_id)}/api/unstable/graphql.json") + @uri = URI.parse("https://partners.shopify.com/#{context.fetch(:organization_id)}/api/#{SHOPIFY_PARTNER_API_VERSION}/graphql.json") super(document: document, operation_name: operation_name, variables: variables, context: context) end From 63721723a8a0ed29b27ddf3e10138c7700bde224 Mon Sep 17 00:00:00 2001 From: Bjorn Forsberg Date: Thu, 12 Oct 2023 12:48:06 +0200 Subject: [PATCH 2/2] TaxTransaction for app_title --- app/models/import/adaptor/shopify_payments_api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/import/adaptor/shopify_payments_api.rb b/app/models/import/adaptor/shopify_payments_api.rb index 6f95270..df45288 100644 --- a/app/models/import/adaptor/shopify_payments_api.rb +++ b/app/models/import/adaptor/shopify_payments_api.rb @@ -126,7 +126,7 @@ def is_yearly_revenue(node) def app_title(node) case node.__typename - when "ReferralAdjustment", "ReferralTransaction", "ServiceSale", "ServiceSaleAdjustment" + when "ReferralAdjustment", "ReferralTransaction", "ServiceSale", "ServiceSaleAdjustment", "TaxTransaction" Payment::UNKNOWN_APP_TITLE when "ThemeSaleAdjustment", "ThemeSale" node.theme&.name