From 2c4bcf85fc8e7186a92c535ae5a7df698176cb47 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 14 Nov 2016 16:23:33 -0600 Subject: [PATCH] 2.1.0 release --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/package.json | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d95dc45..246b0ad 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ This library is still pretty new. It currently suppports the following Shopify A - [Webhooks](#webhooks) - [Script Tags](#script-tags) - [Orders](#orders) +- [Application Credits](#application-credits) More functionality will be added each week until it reachs full parity with Shopify's REST API. @@ -655,4 +656,57 @@ import { Orders } from "shopify-prime"; const service = new Orders(shopDomain, shopAccessToken); const order = await service.open(id); +``` + +### Canceling an Order + +```js +import { Orders } from "shopify-prime"; + +const service = new Orders(shopDomain, shopAccessToken); + +await service.cancel(id, { + reason: "customer" +}); +``` + +## Application Credits + +Shopify's Application Credit API lets you offer credits for payments your app customers have made via the Application Charge, Recurring Application Charge, and Usage Charge APIs. + +The total amount of all Application Credits created by an application must not exceed: + +1. Total amount paid to the application by the shop owner in the last 30 days. +2. Total amount of pending receivables in the partner account associated with the application. + +Additionally, Application Credits cannot be used by private applications. + +### Creating an Application Credit + +```js +const { ApplicationCredits } from "shopify-prime"; + +const service = new ApplicationCredits(shopDomain, shopAccessToken); +const credit = await service.create({ + description: "Refund for Foo", + amount: 10.00 +}); +``` + +### Getting an Application Credit + +```js +const { ApplicationCredits } from "shopify-prime"; + +const service = new ApplicationCredits(shopDomain, shopAccessToken); +const credit = await service.get(id); +``` + +### Listing Application Credits + +```js +const { ApplicationCredits } from "shopify-prime"; + +const service = new ApplicationCredits(shopDomain, shopAccessToken); +const credits = await service.list(); ``` \ No newline at end of file diff --git a/lib/package.json b/lib/package.json index 3776eb6..8b3e855 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "shopify-prime", - "version": "2.0.0", + "version": "2.1.0", "description": "Shopify Prime is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.", "main": "dist/index.js", "typings": "dist/index.d.ts",