@adtrackify/at-service-common 1.0.46 → 1.0.48
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 -3
- package/dist/index.js +17 -21
- package/dist/index.js.map +2 -2
- package/package.json +1 -2
- package/src/clients/third-party/shopify-client.ts +18 -26
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,8 +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
|
|
408
|
-
|
|
406
|
+
static createAppSubscription: (shop: string, accessToken: string, planName: string, price: number, returnUrl: string, trialDays: number, test?: boolean) => 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
|
+
}>;
|
|
409
416
|
static genericShopifyPost: (url: string, accessToken: string, payload: any) => Promise<{
|
|
410
417
|
headers: any;
|
|
411
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,31 +636301,28 @@ __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, test) => {
|
|
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
|
-
trial_days: trialDays
|
|
636310
|
+
trial_days: trialDays,
|
|
636311
|
+
test
|
|
636316
636312
|
};
|
|
636317
|
-
|
|
636318
|
-
|
|
636319
|
-
|
|
636313
|
+
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
|
|
636314
|
+
if (res.status >= 400) {
|
|
636315
|
+
log8.error("Failed to create App Subscription", { shop, accessToken, url });
|
|
636316
|
+
}
|
|
636317
|
+
return res;
|
|
636320
636318
|
});
|
|
636321
|
-
__publicField(ShopifyClient, "
|
|
636322
|
-
const
|
|
636323
|
-
|
|
636324
|
-
|
|
636325
|
-
|
|
636326
|
-
|
|
636327
|
-
|
|
636328
|
-
const response = await client2.recurringApplicationCharge.list();
|
|
636329
|
-
return response;
|
|
636319
|
+
__publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) => {
|
|
636320
|
+
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
636321
|
+
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
636322
|
+
if (res.status >= 400) {
|
|
636323
|
+
log8.error("Failed to get App Subscriptions", { shop, accessToken, url });
|
|
636324
|
+
}
|
|
636325
|
+
return res;
|
|
636330
636326
|
});
|
|
636331
636327
|
__publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload2) => {
|
|
636332
636328
|
const client2 = axiosHttpService();
|