From 143607bebeea60ee62a133db88d651e563ceb751 Mon Sep 17 00:00:00 2001 From: Michal Date: Tue, 19 Mar 2024 16:37:14 +0100 Subject: [PATCH] [DE-759] Release 2.0.0 (#66) * Automated commit message * Fix broken tests * Fix broken tests --------- Co-authored-by: maxio-sdk Co-authored-by: Alberto Blacutt --- README.md | 76 +++++++++++++------------- doc/models/invoice-issued.md | 10 ++-- e2e/src/couponsController.spec.ts | 7 ++- e2e/src/customFieldsController.spec.ts | 36 ------------ package.json | 4 +- src/client.ts | 2 +- src/models/invoiceIssued.ts | 8 ++- 7 files changed, 56 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index fecb1bcb..6e35c01d 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,14 @@ curl -u :x -H Accept:application/json -H Content-Type:application/json Run the following command from your project directory to install the package from npm: ```ts -npm install @maxio-com/advanced-billing-sdk@1.0.1 +npm install @maxio-com/advanced-billing-sdk@2.0.0 ``` -For additional package details, see the [Npm page for the @maxio-com/advanced-billing-sdk@1.0.1 npm](https://www.npmjs.com/package/@maxio-com/advanced-billing-sdk/v/1.0.1). +For additional package details, see the [Npm page for the @maxio-com/advanced-billing-sdk@2.0.0 npm](https://www.npmjs.com/package/@maxio-com/advanced-billing-sdk/v/2.0.0). ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/client.md) The following parameters are configurable for the API Client: @@ -49,7 +49,7 @@ The following parameters are configurable for the API Client: | `timeout` | `number` | Timeout for API calls.
*Default*: `30000` | | `httpClientOptions` | `Partial` | Stable configurable http client options. | | `unstableHttpClientOptions` | `any` | Unstable configurable http client options. | -| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/$a/https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/basic-authentication.md) | The credential object for basicAuth | +| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/$a/https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/basic-authentication.md) | The credential object for basicAuth | ### HttpClientOptions @@ -100,44 +100,44 @@ The SDK can be configured to use a different environment for making API calls. A This API uses the following authentication schemes. -* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/$a/https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/$a/https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/billing-portal.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/billing-portal.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-products.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/controllers/webhooks.md) ## Classes Documentation -* [ApiResponse](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/api-response.md) -* [ApiError](https://www.github.com/maxio-com/ab-typescript-sdk/tree/1.0.1/doc/api-error.md) +* [ApiResponse](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/api-response.md) +* [ApiError](https://www.github.com/maxio-com/ab-typescript-sdk/tree/2.0.0/doc/api-error.md) diff --git a/doc/models/invoice-issued.md b/doc/models/invoice-issued.md index c0f7d150..68696629 100644 --- a/doc/models/invoice-issued.md +++ b/doc/models/invoice-issued.md @@ -12,9 +12,9 @@ | `uid` | `string` | Required | - | | `number` | `string` | Required | - | | `role` | `string` | Required | - | -| `dueDate` | `string` | Required | - | -| `issueDate` | `string` | Required | - | -| `paidDate` | `string` | Required | - | +| `dueDate` | `string \| null` | Required | - | +| `issueDate` | `string` | Required | Invoice issue date. Can be an empty string if value is missing. | +| `paidDate` | `string` | Required | Paid date. Can be an empty string if value is missing. | | `dueAmount` | `string` | Required | - | | `paidAmount` | `string` | Required | - | | `taxAmount` | `string` | Required | - | @@ -33,8 +33,8 @@ "number": "number8", "role": "role2", "due_date": "2016-03-13T12:52:32.123Z", - "issue_date": "2016-03-13T12:52:32.123Z", - "paid_date": "2016-03-13T12:52:32.123Z", + "issue_date": "issue_date0", + "paid_date": "paid_date6", "due_amount": "due_amount6", "paid_amount": "paid_amount4", "tax_amount": "tax_amount2", diff --git a/e2e/src/couponsController.spec.ts b/e2e/src/couponsController.spec.ts index c9ef05da..e98e3481 100644 --- a/e2e/src/couponsController.spec.ts +++ b/e2e/src/couponsController.spec.ts @@ -10,6 +10,7 @@ import { createClient, createInvalidClient } from './config'; import { product } from './mocks/products'; import { createMockSubscription } from './mocks/subscriptions'; import { uid } from 'uid'; +import createProduct from './utils/products'; const couponBody = { coupon: { @@ -280,7 +281,7 @@ describe('Coupons Controller', () => { allowNegativeBalance: false, recurring: false, endDate: '2024-08-29T12:00:00-04:00', - productFamilyId: '0', + productFamilyId: String(productFamily?.id), stackable: true, compoundingStrategy: CompoundingStrategy.Compound, excludeMidPeriodAllocations: true, @@ -545,6 +546,7 @@ describe('Coupons Controller', () => { describe('Create/Update Currency Prices', () => { test('should create a valid currency price', async () => { + const { productFamilyResponse } = await createProduct({}); const createReponse = await couponsController.createCoupon( productFamily?.id || 0, { @@ -555,7 +557,8 @@ describe('Coupons Controller', () => { allowNegativeBalance: false, recurring: false, endDate: '2024-08-29T12:00:00-04:00', - productFamilyId: '0', + productFamilyId: + String(productFamilyResponse.productFamily?.id) || '', stackable: true, compoundingStrategy: CompoundingStrategy.Compound, excludeMidPeriodAllocations: true, diff --git a/e2e/src/customFieldsController.spec.ts b/e2e/src/customFieldsController.spec.ts index 8dc23348..36100849 100644 --- a/e2e/src/customFieldsController.spec.ts +++ b/e2e/src/customFieldsController.spec.ts @@ -14,7 +14,6 @@ import { createTextCustomersField, createTextSubscriptionField, defaultEnum, - defaultHost, dropdownData, excludeScope, includeScope, @@ -244,41 +243,6 @@ describe('Custom Fields Controller', () => { expect(scope?.portal).toBe(payload.metafields.scope.portal); expect(scope?.hosted).toHaveLength(0); }); - - //TODO: should wait nestor's feedback - test.skip('should create a meta fields with hosted scope and input_type=text', async () => { - const payload = { - metafields: { - scope: { - hosted: [...defaultHost], - ...switchedScope, - }, - ...textData, - }, - }; - const { - result: [{ name, inputType, scope }], - statusCode, - } = await customFieldsController.createMetafields( - ResourceType.Subscriptions, - payload - ); - expect(statusCode).toBe(200); - expect(name).toEqual(payload.metafields.name); - expect(inputType).toBe(payload.metafields.inputType); - expect(scope?.publicEdit).toBe(payload.metafields.scope.publicEdit); - expect(scope?.publicShow).toBe(payload.metafields.scope.publicShow); - expect(scope?.csv).toBe(payload.metafields.scope.csv); - expect(scope?.invoices).toBe(payload.metafields.scope.invoices); - expect(scope?.statements).toBe(payload.metafields.scope.statements); - expect(scope?.portal).toBe(payload.metafields.scope.portal); - expect(scope?.hosted).toHaveLength( - payload.metafields.scope.hosted.length - ); - payload.metafields.scope.hosted.map((value) => - expect(scope?.hosted?.includes(value)).toBeTruthy() - ); - }); }); test('should thrown an error when create a single meta fields with empty meta fields', async () => { diff --git a/package.json b/package.json index d3b9eb01..db3a531e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.0.1", + "version": "2.0.0", "license": "MIT", "sideEffects": false, "main": "dist/cjs/index.js", @@ -43,7 +43,7 @@ }, "dependencies": { "@apimatic/authentication-adapters": "^0.5.0", - "@apimatic/axios-client-adapter": "^0.2.0", + "@apimatic/axios-client-adapter": "^0.3.0", "@apimatic/core": "^0.10.0", "@apimatic/schema": "^0.7.0" }, diff --git a/src/client.ts b/src/client.ts index f2e1084a..1a501914 100644 --- a/src/client.ts +++ b/src/client.ts @@ -51,7 +51,7 @@ export class Client implements ClientInterface { ? this._config.httpClientOptions.timeout : this._config.timeout; this._userAgent = updateUserAgent( - 'AB SDK TypeScript:1.0.1 on OS {os-info}', + 'AB SDK TypeScript:2.0.0 on OS {os-info}', ); this._requestBuilderFactory = createRequestHandlerFactory( server => getBaseUri(server, this._config), diff --git a/src/models/invoiceIssued.ts b/src/models/invoiceIssued.ts index d377c9c5..e3c600e3 100644 --- a/src/models/invoiceIssued.ts +++ b/src/models/invoiceIssued.ts @@ -4,7 +4,7 @@ * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ -import { array, expandoObject, lazy, Schema, string } from '../schema'; +import { array, expandoObject, lazy, nullable, Schema, string } from '../schema'; import { InvoiceLineItemEventData, invoiceLineItemEventDataSchema, @@ -14,8 +14,10 @@ export interface InvoiceIssued { uid: string; number: string; role: string; - dueDate: string; + dueDate: string | null; + /** Invoice issue date. Can be an empty string if value is missing. */ issueDate: string; + /** Paid date. Can be an empty string if value is missing. */ paidDate: string; dueAmount: string; paidAmount: string; @@ -33,7 +35,7 @@ export const invoiceIssuedSchema: Schema = expandoObject({ uid: ['uid', string()], number: ['number', string()], role: ['role', string()], - dueDate: ['due_date', string()], + dueDate: ['due_date', nullable(string())], issueDate: ['issue_date', string()], paidDate: ['paid_date', string()], dueAmount: ['due_amount', string()],