@sp-api-sdk/finances-api-v0 1.7.5 → 1.7.9

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/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
4
4
 
5
+ [![npm version](https://badgen.net/npm/v/@sp-api-sdk/finances-api-v0)](https://www.npmjs.com/package/@sp-api-sdk/finances-api-v0)
6
+ [![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](https://github.com/xojs/xo)
7
+
5
8
  ## Documentation
6
9
 
7
10
  Learn more about this Selling Partner API by visiting the [official documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/finances-api/financesV0.md).
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FinancesApiClient = exports.RATE_LIMITS = void 0;
3
+ exports.FinancesApiClient = exports.clientRateLimits = void 0;
4
4
  /* eslint-disable prefer-regex-literals */
5
5
  const common_1 = require("@sp-api-sdk/common");
6
6
  const api_model_1 = require("./api-model");
7
7
  const error_1 = require("./error");
8
- exports.RATE_LIMITS = [
8
+ exports.clientRateLimits = [
9
9
  {
10
10
  method: 'get',
11
11
  urlRegex: new RegExp('^/finances/v0/financialEventGroups$'),
@@ -33,20 +33,23 @@ exports.RATE_LIMITS = [
33
33
  ];
34
34
  class FinancesApiClient extends api_model_1.DefaultApi {
35
35
  constructor(parameters) {
36
- const region = common_1.awsRegionByCode[parameters.region] ?? parameters.region;
36
+ const config = common_1.sellingPartnerRegions[parameters.region];
37
+ if (!config) {
38
+ throw new error_1.FinancesApiError(`Unknown region: ${parameters.region}`);
39
+ }
37
40
  const { rateLimiting, ...clientParameters } = parameters;
38
- const axiosParameters = { ...clientParameters, region };
41
+ const axiosParameters = {
42
+ ...clientParameters,
43
+ region: config.awsRegion,
44
+ };
39
45
  if (rateLimiting?.retry) {
40
- axiosParameters.rateLimits = exports.RATE_LIMITS;
46
+ axiosParameters.rateLimits = exports.clientRateLimits;
41
47
  axiosParameters.onRetry = rateLimiting.onRetry;
42
48
  }
43
49
  const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
44
50
  const configuration = new api_model_1.Configuration();
45
51
  const environment = parameters.sandbox ? 'sandbox' : 'production';
46
- const endpoint = common_1.endpoints[environment][region];
47
- if (!endpoint) {
48
- throw new error_1.FinancesApiError(`Unknown region : ${region}`);
49
- }
52
+ const endpoint = config.endpoints[environment];
50
53
  super(configuration, endpoint, axiosInstance);
51
54
  }
52
55
  }
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable prefer-regex-literals */
2
- import { endpoints, awsRegionByCode, createAxiosInstance } from '@sp-api-sdk/common';
2
+ import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common';
3
3
  import { Configuration, DefaultApi } from './api-model';
4
4
  import { FinancesApiError } from './error';
5
- export const RATE_LIMITS = [
5
+ export const clientRateLimits = [
6
6
  {
7
7
  method: 'get',
8
8
  urlRegex: new RegExp('^/finances/v0/financialEventGroups$'),
@@ -30,20 +30,23 @@ export const RATE_LIMITS = [
30
30
  ];
31
31
  export class FinancesApiClient extends DefaultApi {
32
32
  constructor(parameters) {
33
- const region = awsRegionByCode[parameters.region] ?? parameters.region;
33
+ const config = sellingPartnerRegions[parameters.region];
34
+ if (!config) {
35
+ throw new FinancesApiError(`Unknown region: ${parameters.region}`);
36
+ }
34
37
  const { rateLimiting, ...clientParameters } = parameters;
35
- const axiosParameters = { ...clientParameters, region };
38
+ const axiosParameters = {
39
+ ...clientParameters,
40
+ region: config.awsRegion,
41
+ };
36
42
  if (rateLimiting?.retry) {
37
- axiosParameters.rateLimits = RATE_LIMITS;
43
+ axiosParameters.rateLimits = clientRateLimits;
38
44
  axiosParameters.onRetry = rateLimiting.onRetry;
39
45
  }
40
46
  const axiosInstance = createAxiosInstance(axiosParameters);
41
47
  const configuration = new Configuration();
42
48
  const environment = parameters.sandbox ? 'sandbox' : 'production';
43
- const endpoint = endpoints[environment][region];
44
- if (!endpoint) {
45
- throw new FinancesApiError(`Unknown region : ${region}`);
46
- }
49
+ const endpoint = config.endpoints[environment];
47
50
  super(configuration, endpoint, axiosInstance);
48
51
  }
49
52
  }
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { RemovalShipmentItemAdjustment } from './removal-shipment-item-adjustment';
13
13
  /**
14
- * A financial adjustment event for FBA liquidated inventory. Possible adjustment: * Positive values - Buyer needs to pay more amount to Amazon. E.g. charge was wrongly calculated 0$ instead of 100$ due to system error. * Negative Values - Buyer get refund. E.g. Buyer receives less items or damaged items and as part of their adjustment buyer gets refund.
14
+ * A financial adjustment event for FBA liquidated inventory. A positive value indicates money owed to Amazon by the buyer (for example, when the charge was incorrectly calculated as less than it should be). A negative value indicates a full or partial refund owed to the buyer (for example, when the buyer receives damaged items or fewer items than ordered).
15
15
  * @export
16
16
  * @interface RemovalShipmentAdjustmentEvent
17
17
  */
@@ -1,7 +1,8 @@
1
- import type { ClientConfiguration, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
1
+ import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
2
2
  import { DefaultApi } from './api-model';
3
- export declare const RATE_LIMITS: RateLimit[];
3
+ export declare const clientRateLimits: RateLimit[];
4
4
  export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
5
+ region: SellingPartnerRegion;
5
6
  rateLimiting?: {
6
7
  retry: boolean;
7
8
  onRetry?: OnRetryHandler;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sp-api-sdk/finances-api-v0",
3
3
  "author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
4
4
  "description": "The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.",
5
- "version": "1.7.5",
5
+ "version": "1.7.9",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/es/index.js",
8
8
  "types": "dist/types/index.d.ts",
@@ -25,8 +25,8 @@
25
25
  "test": "NODE_ENV='test' yarn jest"
26
26
  },
27
27
  "dependencies": {
28
- "@sp-api-sdk/auth": "^1.9.5",
29
- "@sp-api-sdk/common": "^1.7.7",
28
+ "@sp-api-sdk/auth": "^1.9.7",
29
+ "@sp-api-sdk/common": "^1.7.9",
30
30
  "axios": "^0.24.0"
31
31
  },
32
32
  "repository": {
@@ -48,5 +48,5 @@
48
48
  "sp sdk",
49
49
  "finances api"
50
50
  ],
51
- "gitHead": "e8c21d7d481263e8a6663ee11f6708d4dc6968b6"
51
+ "gitHead": "dd52e8a895f590c62d06f19f4d8715eb7740df66"
52
52
  }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for Finances
6
- * The Selling Partner API for Finances helps you obtain financial information relevant to a seller\'s business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
7
- *
8
- * The version of the OpenAPI document: v0
9
- *
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for Finances
5
- * The Selling Partner API for Finances helps you obtain financial information relevant to a seller\'s business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
6
- *
7
- * The version of the OpenAPI document: v0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,37 +0,0 @@
1
- /**
2
- * Selling Partner API for Finances
3
- * The Selling Partner API for Finances helps you obtain financial information relevant to a seller\'s business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
4
- *
5
- * The version of the OpenAPI document: v0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import { Currency } from './currency';
13
- /**
14
- * A tax deduction at source (TDS) claim reimbursement event on the seller\'s account.
15
- * @export
16
- * @interface TDSReimbursementEvent
17
- */
18
- export interface TDSReimbursementEvent {
19
- /**
20
- *
21
- * @type {string}
22
- * @memberof TDSReimbursementEvent
23
- */
24
- PostedDate?: string;
25
- /**
26
- * A tax deduction at source (TDS) claim identifier.
27
- * @type {string}
28
- * @memberof TDSReimbursementEvent
29
- */
30
- TdsOrderId?: string;
31
- /**
32
- *
33
- * @type {Currency}
34
- * @memberof TDSReimbursementEvent
35
- */
36
- ReimbursedAmount?: Currency;
37
- }