@adtrackify/at-service-common 1.0.45 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +10 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +16 -10
- package/dist/index.js.map +2 -2
- package/package.json +1 -2
- package/src/clients/third-party/shopify-client.ts +16 -11
package/dist/index.d.ts
CHANGED
|
@@ -344,7 +344,6 @@ declare module '@adtrackify/at-service-common/clients/third-party/index' {
|
|
|
344
344
|
|
|
345
345
|
}
|
|
346
346
|
declare module '@adtrackify/at-service-common/clients/third-party/shopify-client' {
|
|
347
|
-
import Shopify from 'shopify-api-node';
|
|
348
347
|
export class ShopifyClient {
|
|
349
348
|
static _shopify_api_version: string;
|
|
350
349
|
static getConfig: (shopifyDomain: string, accessToken: string) => {
|
|
@@ -404,7 +403,16 @@ declare module '@adtrackify/at-service-common/clients/third-party/shopify-client
|
|
|
404
403
|
data: any;
|
|
405
404
|
status: any;
|
|
406
405
|
}>;
|
|
407
|
-
static
|
|
406
|
+
static createAppSubscription: (shop: string, accessToken: string, planName: string, price: number, returnUrl: string, trialDays: number) => Promise<{
|
|
407
|
+
headers: any;
|
|
408
|
+
data: any;
|
|
409
|
+
status: any;
|
|
410
|
+
}>;
|
|
411
|
+
static listAppSubscriptions: (shop: string, accessToken: string) => Promise<{
|
|
412
|
+
headers: any;
|
|
413
|
+
data: any;
|
|
414
|
+
status: any;
|
|
415
|
+
}>;
|
|
408
416
|
static genericShopifyPost: (url: string, accessToken: string, payload: any) => Promise<{
|
|
409
417
|
headers: any;
|
|
410
418
|
data: any;
|
package/dist/index.js
CHANGED
|
@@ -636229,7 +636229,6 @@ var ShopifyAppInstallClient = class {
|
|
|
636229
636229
|
|
|
636230
636230
|
// src/clients/third-party/shopify-client.ts
|
|
636231
636231
|
import * as log8 from "lambda-log";
|
|
636232
|
-
import Shopify from "shopify-api-node";
|
|
636233
636232
|
var _ShopifyClient = class {
|
|
636234
636233
|
};
|
|
636235
636234
|
var ShopifyClient = _ShopifyClient;
|
|
@@ -636302,20 +636301,27 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
|
|
|
636302
636301
|
}
|
|
636303
636302
|
return res;
|
|
636304
636303
|
});
|
|
636305
|
-
__publicField(ShopifyClient, "
|
|
636306
|
-
const
|
|
636307
|
-
|
|
636308
|
-
shopName: shop
|
|
636309
|
-
};
|
|
636310
|
-
const client2 = new Shopify(config);
|
|
636311
|
-
const createSubscriptionParams = {
|
|
636304
|
+
__publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken, planName, price, returnUrl, trialDays) => {
|
|
636305
|
+
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
636306
|
+
const recurring_application_charge = {
|
|
636312
636307
|
name: planName,
|
|
636313
636308
|
price,
|
|
636314
636309
|
return_url: returnUrl,
|
|
636315
636310
|
trial_days: trialDays
|
|
636316
636311
|
};
|
|
636317
|
-
const
|
|
636318
|
-
|
|
636312
|
+
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
|
|
636313
|
+
if (res.status >= 400) {
|
|
636314
|
+
log8.error("Failed to create App Subscription", { shop, accessToken, url });
|
|
636315
|
+
}
|
|
636316
|
+
return res;
|
|
636317
|
+
});
|
|
636318
|
+
__publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) => {
|
|
636319
|
+
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
636320
|
+
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
636321
|
+
if (res.status >= 400) {
|
|
636322
|
+
log8.error("Failed to get App Subscriptions", { shop, accessToken, url });
|
|
636323
|
+
}
|
|
636324
|
+
return res;
|
|
636319
636325
|
});
|
|
636320
636326
|
__publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload2) => {
|
|
636321
636327
|
const client2 = axiosHttpService();
|