Skip to content

Commit

Permalink
Merge pull request #105 from square/release/22.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joanc-sq committed Sep 21, 2022
2 parents e2ce966 + af0ec91 commit f9c27b6
Show file tree
Hide file tree
Showing 59 changed files with 349 additions and 333 deletions.
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

Use this JavaScript library to manage Square resources (such as payments, orders, items, and inventory) for your own Square account or on behalf of Square sellers.

* [Requirements](#requirements)
* [Installation](#installation)
* [Quickstart](#quickstart)
* [Usage](#usage)
* [Tests](#tests)
* [SDK Reference](#sdk-reference)
* [Deprecated APIs](#deprecated-apis)

## Requirements

Use of the Square Node.js SDK requires:
Expand Down Expand Up @@ -114,18 +122,18 @@ npm test
* [Sites]
* [Snippets]

### Authorization APIs
### Authorization
* [Mobile Authorization]
* [OAuth]

### Deprecated APIs
* [Employees]
* [V1 Employees]
* [V1 Transactions]
* [V1 Items]
* [Transactions]


## Deprecated APIs
The following Square APIs are [deprecated](https://developer.squareup.com/docs/build-basics/api-lifecycle):
* [Employees] - replaced by the [Team] API. For more information, see [Migrate from the Employees API](https://developer.squareup.com/docs/team/migrate-from-v2-employees).
* [Transactions] - replaced by the [Orders] and [Payments] APIs. For more information, see [Migrate from the Transactions API](https://developer.squareup.com/docs/payments-api/migrate-from-transactions-api).

[Developer Dashboard]: https://developer.squareup.com/apps
[Square API]: https://squareup.com/developers
Expand All @@ -147,7 +155,6 @@ npm test
[Catalog]: doc/api/catalog.md
[Customers]: doc/api/customers.md
[Customer Custom Attributes]: doc/api/customer-custom-attributes.md
[Employees]: doc/api/employees.md
[Inventory]: doc/api/inventory.md
[Labor]: doc/api/labor.md
[Loyalty]: doc/api/loyalty.md
Expand All @@ -161,13 +168,11 @@ npm test
[Subscriptions]: doc/api/subscriptions.md
[Mobile Authorization]: doc/api/mobile-authorization.md
[OAuth]: doc/api/o-auth.md
[V1 Employees]: doc/api/v1-employees.md
[V1 Transactions]: doc/api/v1-transactions.md
[V1 Items]: doc/api/v1-items.md
[Transactions]: doc/api/transactions.md
[Sites]: doc/api/sites.md
[Snippets]: doc/api/snippets.md
[Cards]: doc/api/cards.md
[Payouts]: doc/api/payouts.md
[Gift Cards]: doc/api/gift-cards.md
[Gift Card Activities]: doc/api/gift-card-activities.md
[Employees]: doc/api/employees.md
[Transactions]: doc/api/transactions.md
6 changes: 4 additions & 2 deletions doc/api/apple-pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ an Apple Pay enabled domain.
This endpoint provides an easy way for platform developers to bulk activate
Apple Pay on the Web with Square for merchants using their platform.

To learn more about Web Apple Pay, see
[Add the Apple Pay on the Web Button](https://developer.squareup.com/docs/payment-form/add-digital-wallets/apple-pay).
Note: The SqPaymentForm library is deprecated as of May 13, 2021, and will only receive critical security updates until it is retired on October 31, 2022.
You must migrate your payment form code to the Web Payments SDK to continue using your domain for Apple Pay. For more information on migrating to the Web Payments SDK, see [Migrate to the Web Payments SDK](https://developer.squareup.com/docs/web-payments/migrate).

To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay Payment](https://developer.squareup.com/docs/web-payments/apple-pay).

```ts
async registerDomain(
Expand Down
4 changes: 2 additions & 2 deletions doc/api/cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ async createCard(

```ts
const contentType = null;
const bodyCardBillingAddress: Address = {};
const bodyCardBillingAddressCountry: string = {'' : null, '' : null } const bodyCardBillingAddress: Address = {};
bodyCardBillingAddress.addressLine1 = '500 Electric Ave';
bodyCardBillingAddress.addressLine2 = 'Suite 600';
bodyCardBillingAddress.locality = 'New York';
bodyCardBillingAddress.administrativeDistrictLevel1 = 'NY';
bodyCardBillingAddress.postalCode = '10003';
bodyCardBillingAddress.country = 'US';
bodyCardBillingAddress.country = bodyCardBillingAddressCountry;

const bodyCard: Card = {};
bodyCard.cardholderName = 'Amelia Earhart';
Expand Down
66 changes: 33 additions & 33 deletions doc/api/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,16 @@ const bodyBatches: CatalogObjectBatch[] = [];

const bodybatches0Objects: CatalogObject[] = [];

const bodybatches0objects0ItemDataTaxIds: string[] = ['#SalesTax'];
const bodybatches0objects0Type: string = {'' : null, '' : null, '' : null, '' : null } const bodybatches0objects0ItemDataTaxIds: string[] = ['#SalesTax'];
const bodybatches0objects0ItemDataVariations: CatalogObject[] = [];

const bodybatches0objects0ItemDatavariations0ItemVariationData: CatalogItemVariation = {};
const bodybatches0objects0ItemDatavariations0Type: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects0ItemDatavariations0ItemVariationDataPricingType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects0ItemDatavariations0ItemVariationData: CatalogItemVariation = {};
bodybatches0objects0ItemDatavariations0ItemVariationData.itemId = '#Tea';
bodybatches0objects0ItemDatavariations0ItemVariationData.name = 'Mug';
bodybatches0objects0ItemDatavariations0ItemVariationData.pricingType = 'FIXED_PRICING';
bodybatches0objects0ItemDatavariations0ItemVariationData.pricingType = bodybatches0objects0ItemDatavariations0ItemVariationDataPricingType;

const bodybatches0objects0ItemDatavariations0: CatalogObject = {
type: 'ITEM_VARIATION',
type: bodybatches0objects0ItemDatavariations0Type,
id: '#Tea_Mug',
};
bodybatches0objects0ItemDatavariations0.presentAtAllLocations = true;
Expand All @@ -191,38 +191,38 @@ bodybatches0objects0ItemData.variations = bodybatches0objects0ItemDataVariations
bodybatches0objects0ItemData.descriptionHtml = '<p><strong>Hot</strong> Leaf Juice</p>';

const bodybatches0objects0: CatalogObject = {
type: 'ITEM',
type: bodybatches0objects0Type,
id: '#Tea',
};
bodybatches0objects0.presentAtAllLocations = true;
bodybatches0objects0.itemData = bodybatches0objects0ItemData;

bodybatches0Objects[0] = bodybatches0objects0;

const bodybatches0objects1ItemDataTaxIds: string[] = ['#SalesTax'];
const bodybatches0objects1Type: string = {'' : null, '' : null, '' : null, '' : null } const bodybatches0objects1ItemDataTaxIds: string[] = ['#SalesTax'];
const bodybatches0objects1ItemDataVariations: CatalogObject[] = [];

const bodybatches0objects1ItemDatavariations0ItemVariationData: CatalogItemVariation = {};
const bodybatches0objects1ItemDatavariations0Type: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects1ItemDatavariations0ItemVariationDataPricingType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects1ItemDatavariations0ItemVariationData: CatalogItemVariation = {};
bodybatches0objects1ItemDatavariations0ItemVariationData.itemId = '#Coffee';
bodybatches0objects1ItemDatavariations0ItemVariationData.name = 'Regular';
bodybatches0objects1ItemDatavariations0ItemVariationData.pricingType = 'FIXED_PRICING';
bodybatches0objects1ItemDatavariations0ItemVariationData.pricingType = bodybatches0objects1ItemDatavariations0ItemVariationDataPricingType;

const bodybatches0objects1ItemDatavariations0: CatalogObject = {
type: 'ITEM_VARIATION',
type: bodybatches0objects1ItemDatavariations0Type,
id: '#Coffee_Regular',
};
bodybatches0objects1ItemDatavariations0.presentAtAllLocations = true;
bodybatches0objects1ItemDatavariations0.itemVariationData = bodybatches0objects1ItemDatavariations0ItemVariationData;

bodybatches0objects1ItemDataVariations[0] = bodybatches0objects1ItemDatavariations0;

const bodybatches0objects1ItemDatavariations1ItemVariationData: CatalogItemVariation = {};
const bodybatches0objects1ItemDatavariations1Type: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects1ItemDatavariations1ItemVariationDataPricingType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects1ItemDatavariations1ItemVariationData: CatalogItemVariation = {};
bodybatches0objects1ItemDatavariations1ItemVariationData.itemId = '#Coffee';
bodybatches0objects1ItemDatavariations1ItemVariationData.name = 'Large';
bodybatches0objects1ItemDatavariations1ItemVariationData.pricingType = 'FIXED_PRICING';
bodybatches0objects1ItemDatavariations1ItemVariationData.pricingType = bodybatches0objects1ItemDatavariations1ItemVariationDataPricingType;

const bodybatches0objects1ItemDatavariations1: CatalogObject = {
type: 'ITEM_VARIATION',
type: bodybatches0objects1ItemDatavariations1Type,
id: '#Coffee_Large',
};
bodybatches0objects1ItemDatavariations1.presentAtAllLocations = true;
Expand All @@ -238,36 +238,36 @@ bodybatches0objects1ItemData.variations = bodybatches0objects1ItemDataVariations
bodybatches0objects1ItemData.descriptionHtml = '<p>Hot <em>Bean Juice</em></p>';

const bodybatches0objects1: CatalogObject = {
type: 'ITEM',
type: bodybatches0objects1Type,
id: '#Coffee',
};
bodybatches0objects1.presentAtAllLocations = true;
bodybatches0objects1.itemData = bodybatches0objects1ItemData;

bodybatches0Objects[1] = bodybatches0objects1;

const bodybatches0objects2CategoryData: CatalogCategory = {};
const bodybatches0objects2Type: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects2CategoryData: CatalogCategory = {};
bodybatches0objects2CategoryData.name = 'Beverages';

const bodybatches0objects2: CatalogObject = {
type: 'CATEGORY',
type: bodybatches0objects2Type,
id: '#Beverages',
};
bodybatches0objects2.presentAtAllLocations = true;
bodybatches0objects2.categoryData = bodybatches0objects2CategoryData;

bodybatches0Objects[2] = bodybatches0objects2;

const bodybatches0objects3TaxData: CatalogTax = {};
const bodybatches0objects3Type: string = {'' : null, '' : null, '' : null } const bodybatches0objects3TaxDataCalculationPhase: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects3TaxDataInclusionType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodybatches0objects3TaxData: CatalogTax = {};
bodybatches0objects3TaxData.name = 'Sales Tax';
bodybatches0objects3TaxData.calculationPhase = 'TAX_SUBTOTAL_PHASE';
bodybatches0objects3TaxData.inclusionType = 'ADDITIVE';
bodybatches0objects3TaxData.calculationPhase = bodybatches0objects3TaxDataCalculationPhase;
bodybatches0objects3TaxData.inclusionType = bodybatches0objects3TaxDataInclusionType;
bodybatches0objects3TaxData.percentage = '5.0';
bodybatches0objects3TaxData.appliesToCustomAmounts = true;
bodybatches0objects3TaxData.enabled = true;

const bodybatches0objects3: CatalogObject = {
type: 'TAX',
type: bodybatches0objects3Type,
id: '#SalesTax',
};
bodybatches0objects3.presentAtAllLocations = true;
Expand Down Expand Up @@ -331,11 +331,11 @@ async createCatalogImage(
## Example Usage

```ts
const requestImageImageData: CatalogImage = {};
const requestImageType: string = {'' : null, '' : null, '' : null, '' : null, '' : null } const requestImageImageData: CatalogImage = {};
requestImageImageData.caption = 'A picture of a cup of coffee';

const requestImage: CatalogObject = {
type: 'IMAGE',
type: requestImageType,
id: '#TEMP_ID',
};
requestImage.imageData = requestImageImageData;
Expand Down Expand Up @@ -521,33 +521,33 @@ async upsertCatalogObject(

```ts
const contentType = null;
const bodyObjectItemDataVariations: CatalogObject[] = [];
const bodyObjectType: string = {'' : null, '' : null, '' : null, '' : null } const bodyObjectItemDataVariations: CatalogObject[] = [];

const bodyObjectItemDatavariations0ItemVariationData: CatalogItemVariation = {};
const bodyObjectItemDatavariations0Type: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodyObjectItemDatavariations0ItemVariationDataPricingType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodyObjectItemDatavariations0ItemVariationData: CatalogItemVariation = {};
bodyObjectItemDatavariations0ItemVariationData.itemId = '#Cocoa';
bodyObjectItemDatavariations0ItemVariationData.name = 'Small';
bodyObjectItemDatavariations0ItemVariationData.pricingType = 'VARIABLE_PRICING';
bodyObjectItemDatavariations0ItemVariationData.pricingType = bodyObjectItemDatavariations0ItemVariationDataPricingType;

const bodyObjectItemDatavariations0: CatalogObject = {
type: 'ITEM_VARIATION',
type: bodyObjectItemDatavariations0Type,
id: '#Small',
};
bodyObjectItemDatavariations0.itemVariationData = bodyObjectItemDatavariations0ItemVariationData;

bodyObjectItemDataVariations[0] = bodyObjectItemDatavariations0;

const bodyObjectItemDatavariations1ItemVariationDataPriceMoney: Money = {};
bodyObjectItemDatavariations1ItemVariationDataPriceMoney.amount = 400;
bodyObjectItemDatavariations1ItemVariationDataPriceMoney.currency = 'USD';
const bodyObjectItemDatavariations1Type: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodyObjectItemDatavariations1ItemVariationDataPricingType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const bodyObjectItemDatavariations1ItemVariationDataPriceMoneyCurrency: string = {'' : null, '' : null, '' : null } const bodyObjectItemDatavariations1ItemVariationDataPriceMoney: Money = {};
bodyObjectItemDatavariations1ItemVariationDataPriceMoney.amount = BigInt(400);
bodyObjectItemDatavariations1ItemVariationDataPriceMoney.currency = bodyObjectItemDatavariations1ItemVariationDataPriceMoneyCurrency;

const bodyObjectItemDatavariations1ItemVariationData: CatalogItemVariation = {};
bodyObjectItemDatavariations1ItemVariationData.itemId = '#Cocoa';
bodyObjectItemDatavariations1ItemVariationData.name = 'Large';
bodyObjectItemDatavariations1ItemVariationData.pricingType = 'FIXED_PRICING';
bodyObjectItemDatavariations1ItemVariationData.pricingType = bodyObjectItemDatavariations1ItemVariationDataPricingType;
bodyObjectItemDatavariations1ItemVariationData.priceMoney = bodyObjectItemDatavariations1ItemVariationDataPriceMoney;

const bodyObjectItemDatavariations1: CatalogObject = {
type: 'ITEM_VARIATION',
type: bodyObjectItemDatavariations1Type,
id: '#Large',
};
bodyObjectItemDatavariations1.itemVariationData = bodyObjectItemDatavariations1ItemVariationData;
Expand All @@ -561,7 +561,7 @@ bodyObjectItemData.variations = bodyObjectItemDataVariations;
bodyObjectItemData.descriptionHtml = '<p><strong>Hot</strong> Chocolate</p>';

const bodyObject: CatalogObject = {
type: 'ITEM',
type: bodyObjectType,
id: '#Cocoa',
};
bodyObject.itemData = bodyObjectItemData;
Expand Down Expand Up @@ -778,7 +778,7 @@ const contentType = null;
const bodyCategoryIds: string[] = ['WINE_CATEGORY_ID'];
const bodyStockLevels: string[] = ['OUT', 'LOW'];
const bodyEnabledLocationIds: string[] = ['ATL_LOCATION_ID'];
const bodyProductTypes: string[] = ['REGULAR'];
const bodySortOrder: string = {'' : null, '' : null, '' : null } const bodyProductTypes: string[] = ['REGULAR'];
const bodyCustomAttributeFilters: CustomAttributeFilter[] = [];

const bodycustomAttributeFilters0: CustomAttributeFilter = {};
Expand Down Expand Up @@ -814,7 +814,7 @@ body.categoryIds = bodyCategoryIds;
body.stockLevels = bodyStockLevels;
body.enabledLocationIds = bodyEnabledLocationIds;
body.limit = 100;
body.sortOrder = 'ASC';
body.sortOrder = bodySortOrder;
body.productTypes = bodyProductTypes;
body.customAttributeFilters = bodyCustomAttributeFilters;

Expand Down
Loading

0 comments on commit f9c27b6

Please sign in to comment.