Browse Source

Add new resource for TenderTransactions, add json test fixtures

Style

Add fixture json

Add test class

Style

Add sample tenders

Fix json formatting

Rename fixture file

Correctly reference fixture in test

Add wip
berkcaputcu 6 năm trước cách đây
mục cha
commit
5eb50bf2f1

+ 6 - 0
lib/shopify_api/resources/tender_transaction.rb

@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+module ShopifyAPI
+  class TenderTransaction < Base
+  end
+end

+ 52 - 0
test/fixtures/tender_transactions.json

@@ -0,0 +1,52 @@
+{
+  "tender_transactions": [
+    {
+      "id": 1,
+      "order_id": 450789469,
+      "amount": "138.46",
+      "currency": "CAD",
+      "user_id": null,
+      "test": true,
+      "processed_at": "2018-08-09T15:43:39-04:00",
+      "updated_at": "2018-08-09T15:43:41-04:00",
+      "remote_reference": "1118366",
+      "payment_method": "credit_card",
+      "payment_details": {
+        "credit_card_number": "•••• •••• •••• 1",
+        "credit_card_company": "Bogus"
+      }
+    },
+    {
+      "id": 2,
+      "order_id": 450789469,
+      "amount": "128.16",
+      "currency": "CAD",
+      "user_id": null,
+      "test": true,
+      "processed_at": "2018-08-11T15:43:39-04:00",
+      "updated_at": "2018-08-09T15:43:41-04:00",
+      "remote_reference": "1118367",
+      "payment_method": "credit_card",
+      "payment_details": {
+        "credit_card_number": "•••• •••• •••• 2",
+        "credit_card_company": "Bogus"
+      }
+    },
+    {
+      "id": 3,
+      "order_id": 450789469,
+      "amount": "28.16",
+      "currency": "CAD",
+      "user_id": null,
+      "test": true,
+      "processed_at": "2018-08-12T15:43:39-04:00",
+      "updated_at": "2018-08-09T15:43:41-04:00",
+      "remote_reference": "1118368",
+      "payment_method": "credit_card",
+      "payment_details": {
+        "credit_card_number": "•••• •••• •••• 2",
+        "credit_card_company": "Bogus"
+      }
+    }
+  ]
+}

+ 16 - 0
test/tender_transaction_test.rb

@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+class TenderTransactionTest < Test::Unit::TestCase
+  def setup
+    super
+    fake "/tender_transactions.json", method: :get, body: load_fixture('tender_transactions')
+  end
+
+  context "Tender Transaction" do
+    should 'return a list of transactions' do
+      tender_transactions = ShopifyAPI::TenderTransaction.all
+    end
+  end
+end