diff --git a/app/models/import/adaptor/shopify_payments_api.rb b/app/models/import/adaptor/shopify_payments_api.rb index 4bbfdb5..5cb8111 100644 --- a/app/models/import/adaptor/shopify_payments_api.rb +++ b/app/models/import/adaptor/shopify_payments_api.rb @@ -37,6 +37,11 @@ class Import::Adaptor::ShopifyPaymentsApi ] }.freeze + UNSUPPORTED_TRANSACTION_TYPES = [ + "TaxTransaction", + "LegacyTransaction" + ].freeze + def initialize(import:, import_payments_after_date:) @import = import @import_payments_after_date = import_payments_after_date.strftime("%Y-%m-%dT%H:%M:%S.%L%z") @@ -70,6 +75,8 @@ def stream_payments(main_enum) @cursor = results.data.transactions.edges.last.cursor transactions.each do |transaction| + next if unsupported?(transaction.node) + main_enum.yield parse(transaction.node) end end @@ -98,6 +105,10 @@ def parse(node) } end + def unsupported?(node) + UNSUPPORTED_TRANSACTION_TYPES.find { |type| node&.id&.include?(type) }.present? + end + def charge_type(node) API_REVENUE_TYPES.find { |_key, value| value.include?(node.__typename) }&.first end