Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- Added support for Fulfillment.update_tracking ([#432](https://github.com/Shopify/shopify_python_api/pull/432))
- Add FulfillmentEvent resource ([#454](https://github.com/Shopify/shopify_python_api/pull/454))
- Fix for being unable to get the len() of a filter ([#456](https://github.com/Shopify/shopify_python_api/pull/456))
- Add ApplicationCredit resource ([#457](https://github.com/Shopify/shopify_python_api/pull/457))

== Version 8.2.0
- [Feature] Add support for Dynamic API Versioning. When the library is initialized, it will now make a request to
Expand Down
1 change: 1 addition & 0 deletions shopify/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .tax_line import TaxLine
from .script_tag import ScriptTag
from .application_charge import ApplicationCharge
from .application_credit import ApplicationCredit
from .recurring_application_charge import RecurringApplicationCharge
from .usage_charge import UsageCharge
from .asset import Asset
Expand Down
4 changes: 4 additions & 0 deletions shopify/resources/application_credit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ..base import ShopifyResource

class ApplicationCredit(ShopifyResource):
pass
38 changes: 38 additions & 0 deletions test/application_credit_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import shopify
import json
from test.test_helper import TestCase

class ApplicationCreditTest(TestCase):
def test_get_application_credit(self):
self.fake('application_credits/445365009', method='GET', body=self.load_fixture('application_credit'), code=200)
application_credit = shopify.ApplicationCredit.find(445365009)
self.assertEqual('5.00', application_credit.amount)

def test_get_all_application_credits(self):
self.fake('application_credits', method='GET', body=self.load_fixture('application_credits'), code=200)
application_credits = shopify.ApplicationCredit.find()
self.assertEqual(1, len(application_credits))
self.assertEqual(445365009, application_credits[0].id)

def test_create_application_credit(self):
self.fake(
'application_credits',
method='POST',
body=self.load_fixture('application_credit'),
headers={'Content-type': 'application/json'},
code=201
)

application_credit = shopify.ApplicationCredit.create({
'description': 'application credit for refund',
'amount': 5.0
})

expected_body = {
"application_credit": {
"description": "application credit for refund",
"amount": 5.0
}
}

self.assertEqual(expected_body, json.loads(self.http.request.data.decode("utf-8")))
8 changes: 8 additions & 0 deletions test/fixtures/application_credit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"application_credit": {
"id": 445365009,
"amount": "5.00",
"description": "credit for application refund",
"test": null
}
}
10 changes: 10 additions & 0 deletions test/fixtures/application_credits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"application_credits": [
{
"id": 445365009,
"amount": "5.00",
"description": "credit for application refund",
"test": null
}
]
}
2 changes: 0 additions & 2 deletions test/fulfillment_event_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import shopify
from test.test_helper import TestCase
from pyactiveresource.activeresource import ActiveResource

class FulFillmentEventTest(TestCase):
def test_get_fulfillment_event(self):
Expand All @@ -21,4 +20,3 @@ def test_error_on_incorrect_status(self):
fulfillment_event = shopify.FulfillmentEvent.find(12584341209251, order_id='2776493818019', fulfillment_id='2608403447971')
fulfillment_event.status = incorrect_status
fulfillment_event.save()