Skip to content

Commit

Permalink
[DE-759] Release 2.0.0 (#66)
Browse files Browse the repository at this point in the history
* Automated commit message

* Fix broken tests

* Fix broken tests

---------

Co-authored-by: maxio-sdk <[email protected]>
Co-authored-by: Alberto Blacutt <[email protected]>
  • Loading branch information
3 people authored Mar 19, 2024
1 parent 18d4c74 commit 143607b
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 87 deletions.
76 changes: 38 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ curl -u <api_key>: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:

Expand All @@ -49,7 +49,7 @@ The following parameters are configurable for the API Client:
| `timeout` | `number` | Timeout for API calls.<br>*Default*: `30000` |
| `httpClientOptions` | `Partial<HttpClientOptions>` | 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

Expand Down Expand Up @@ -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)

10 changes: 5 additions & 5 deletions doc/models/invoice-issued.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | - |
Expand All @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions e2e/src/couponsController.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
{
Expand All @@ -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,
Expand Down
36 changes: 0 additions & 36 deletions e2e/src/customFieldsController.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
createTextCustomersField,
createTextSubscriptionField,
defaultEnum,
defaultHost,
dropdownData,
excludeScope,
includeScope,
Expand Down Expand Up @@ -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 () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "2.0.0",
"license": "MIT",
"sideEffects": false,
"main": "dist/cjs/index.js",
Expand Down Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 5 additions & 3 deletions src/models/invoiceIssued.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -33,7 +35,7 @@ export const invoiceIssuedSchema: Schema<InvoiceIssued> = 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()],
Expand Down

0 comments on commit 143607b

Please sign in to comment.