Skip to content

Commit

Permalink
Generated PR for Release: 12.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
autobot committed Jun 15, 2021
1 parent 3c1d703 commit 7324040
Show file tree
Hide file tree
Showing 279 changed files with 5,387 additions and 521 deletions.
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# Change Log

## Version 12.0.0 (2021-06-16)
## New API releases
* **Gift Cards API and Gift Card Activities API.** Gift card support is integrated in the [Square Seller Dashboard](https://squareup.com/dashboard/) and the [Square Point of Sale](https://squareup.com/us/en/point-of-sale) application. Sellers can sell, redeem, track, and reload Square gift cards. Now developers can use the [Gift Cards API](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api) and the [Gift Card Activities API](https://developer.squareup.com/reference/square_2021-06-16/gift-card-activities-api) to integrate Square gift cards into third-party applications. For more information, see [Gift Cards API Overview.](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api)

* **Cards API.** The [Cards API](https://developer.squareup.com/reference/square_2021-06-16/cards-api) replaces the deprecated `CreateCustomerCard` and `DeleteCustomerCard` endpoints and lets an application save a customer payment card on file along with other card management operations. For more information, see [Cards API Overview.](https://developer.squareup.com/docs/cards-api/overview)

## API updates
* **Catalog API:**
* [CatalogPricingRule](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogPricingRule). Support of the [customer group discount](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogPricingRule#definition__property-customer_group_ids_any) becomes GA. For more information, see [CreateCustomerGroupDiscounts.](https://developer.squareup.com/docs/catalog-api/configure-customer-group-discounts)
* [CatalogItemVariation](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation). Offers Beta support of the [stockable](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation#definition__property-stockable) and [stockable_conversion](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation#definition__property-stockable_conversion) attributes to enable sales of a product in multiple measurement units.
* [UpsertCatalogObject](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/upsert-catalog-object) and [BatchUpsertCatalogObjects](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/batch-upsert-catalog-objects). Support creating an item with stockable and non-stockable variations with a specified stock conversion between the two. For more information, see [Enable Stock Conversion.](https://developer.squareup.com/docs/inventory-api/enable-stock-conversion)
* [UpsertCatalogObject](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/upsert-catalog-object) and [BatchUpsertCatalogObjects](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/batch-upsert-catalog-objects). Require that an item be created with at least one variation. Otherwise, an `INVALID_REQUEST` error is returned.

* **Customers API:**
* Using the Customers API to manage cards on file is deprecated:
* The [CreateCustomerCard](https://developer.squareup.com/reference/square_2021-06-16/customers-api/create-customer-card) endpoint is deprecated and replaced by the [CreateCard](https://developer.squareup.com/reference/square_2021-06-16/cards-api/create-card) and [LinkCustomerToGiftCard](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/link-customer-to-gift-card) endpoints.
* The [DeleteCustomerCard](https://developer.squareup.com/reference/square_2021-06-16/customers-api/delete-customer-card) endpoint is deprecated and replaced by the [DisableCard](https://developer.squareup.com/reference/square_2021-06-16/cards-api/disable-card) and [UnlinkCustomerFromGiftCard](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/unlink-customer-from-gift-card) endpoints.
* The `cards` field in the [Customer](https://developer.squareup.com/reference/square_2021-06-16/objects/Customer) object is deprecated and replaced by the following endpoints:
* [ListCards](https://developer.squareup.com/reference/square_2021-06-16/cards-api/list-cards) to retrieve credit and debit cards on file.
* [ListGiftCards](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/list-gift-cards) to retrieve gift cards on file.

For more information, see [Migrate to the Cards API and Gift Cards API.](https://developer.squareup.com/docs/customers-api/use-the-api/integrate-with-other-services#migrate-customer-cards)

* [Customer](https://developer.squareup.com/reference/square_2021-06-16/objects/Customer) object. In the `cards` field, the IDs for gift cards now have a `gftc:` prefix followed by the card number. This is a service-level change that applies to all Square API versions.

* **Disputes API:**
* The Disputes API is now GA.
* `RemoveDisputeEvidence`. Renamed to [DeleteDisputeEvidence](https://developer.squareup.com/reference/square_2021-06-16/objects/DeleteDisputeEvidence).
* [CreateDisputeEvidenceFile.](https://developer.squareup.com/reference/square_2021-06-16/objects/CreateDisputeEvidenceFile) The URL is changed from `/v2/disputes/{dispute_id}/evidence_file` to `/v2/disputes/{dispute_id}/evidence-files`.
* [CreateDisputeEvidenceText.](https://developer.squareup.com/reference/square_2021-06-16/objects/CreateDisputeEvidenceText) The URL is changed from `/v2/disputes/{dispute_id}/evidence_text` to `/v2/disputes/{dispute_id}/evidence-text`.
* [ListDisputeEvidence.](https://developer.squareup.com/reference/square_2021-06-16/objects/ListDisputeEvidence) The endpoint now returns a pagination cursor and accepts a pagination cursor in requests.
* `DISPUTES_READ` and `DISPUTES_WRITE` permissions are required for all Disputes API endpoints instead of `PAYMENTS_READ` and `PAYMENTS_WRITE`.
* [DisputeEvidence.](https://developer.squareup.com/reference/square_2021-06-16/objects/DisputeEvidence) The `evidence_id` field is deprecated and replaced by the `id` field.
* The `dispute.state.changed` webhook is renamed to `dispute.state.updated`.
* [Dispute](https://developer.squareup.com/reference/square_2021-06-16/objects/Dispute) object. The following breaking changes are made:
* The `dispute_id` field is deprecated and replaced by the `id` field.
* The `reported_date` field is deprecated and replaced by the `reported_at` field.
* The `evidence_ids` field is deprecated with no replacement.

For more information about the GA release of the Disputes API, see [Disputes Overview.](https://developer.squareup.com/docs/disputes-api/overview)


* **Inventory API:**
* [CatalogStockConversion](https://developer.squareup.com/docs/{SQUARE_TECH_REF}/objects/CatalogStockConversion) (Beta). Enables selling a product in multiple measurement units and lets Square sellers manage inventory counts of the product's stockable and a non-stockable variations in a self-consistent manner. For more information, see [Enable Stock Conversion.](https://developer.squareup.com/docs/inventory-api/enable-stock-conversion)

* **Invoices API:**
* [CreateInvoice.](https://developer.squareup.com/reference/square_2021-06-16/invoices-api/create-invoice) The `location_id` field is now optional and defaults to the location ID of the associated order. If specified in the request, the value must match the location ID of the associated order. This is a service-level change that applies to all Square API versions.

* **Loyalty API:**
* [LoyaltyProgramAccrualRule](https://developer.squareup.com/reference/square_2021-06-16/objects/LoyaltyProgramAccrualRule) object. New `excluded_category_ids` and `excluded_item_variation_ids` fields that represent any categories and items that are excluded from accruing points in spend-based loyalty programs.

* **Subscriptions API:**
* [Subscription.](https://developer.squareup.com/reference/square_2021-06-16/objects/Subscription) The `paid_until_date` field is renamed to `charge_through_date`.
* [UpdateSubscription.](https://developer.squareup.com/reference/square_2021-06-16/subscriptions-api/update-subscription) The `version` field is now optional because it can update only the latest version of a subscription.

* [CreateSubscription.](https://developer.squareup.com/reference/square_2021-06-16/subscriptions-api/create-subscription) The `idempotency_key` field is now optional in the request. If you do not provide it, each `CreateSubscription` assumes a unique (never used before) value and creates a subscription for each call.

## Documentation updates
* [Order fee structure.](https://developer.squareup.com/docs/payments-pricing#orders-api-fee-structure) Documented the transaction fee related to using the Orders API with a non-Square payments provider.


## Version 11.0.0 (2021-05-13)
## New API releases

Expand Down
214 changes: 214 additions & 0 deletions doc/api/cards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
# Cards

```ts
const cardsApi = client.cardsApi;
```

## Class Name

`CardsApi`

## Methods

* [List Cards](/doc/api/cards.md#list-cards)
* [Create Card](/doc/api/cards.md#create-card)
* [Retrieve Card](/doc/api/cards.md#retrieve-card)
* [Disable Card](/doc/api/cards.md#disable-card)


# List Cards

Retrieves a list of cards owned by the account making the request.
A max of 25 cards will be returned.

```ts
async listCards(
cursor?: string,
customerId?: string,
includeDisabled?: boolean,
referenceId?: string,
sortOrder?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListCardsResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
| `customerId` | `string \| undefined` | Query, Optional | Limit results to cards associated with the customer supplied.<br>By default, all cards owned by the merchant are returned. |
| `includeDisabled` | `boolean \| undefined` | Query, Optional | Includes disabled cards.<br>By default, all enabled cards owned by the merchant are returned.<br>**Default**: `false` |
| `referenceId` | `string \| undefined` | Query, Optional | Limit results to cards associated with the reference_id supplied. |
| `sortOrder` | [`string \| undefined`](/doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the card was created with the specified order.<br>This field defaults to ASC. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`ListCardsResponse`](/doc/models/list-cards-response.md)

## Example Usage

```ts
const cursor = 'cursor6';
const customerId = 'customer_id8';
const includeDisabled = false;
const referenceId = 'reference_id2';
const sortOrder = 'DESC';
try {
const { result, ...httpResponse } = await cardsApi.listCards(cursor, customerId, includeDisabled, referenceId, sortOrder);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```


# Create Card

Adds a card on file to an existing merchant.

```ts
async createCard(
body: CreateCardRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateCardResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `body` | [`CreateCardRequest`](/doc/models/create-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`CreateCardResponse`](/doc/models/create-card-response.md)

## Example Usage

```ts
const bodyCardBillingAddress: Address = {};
bodyCardBillingAddress.addressLine1 = '500 Electric Ave';
bodyCardBillingAddress.addressLine2 = 'Suite 600';
bodyCardBillingAddress.addressLine3 = 'address_line_34';
bodyCardBillingAddress.locality = 'New York';
bodyCardBillingAddress.sublocality = 'sublocality8';
bodyCardBillingAddress.administrativeDistrictLevel1 = 'NY';
bodyCardBillingAddress.postalCode = '10003';
bodyCardBillingAddress.country = 'US';

const bodyCard: Card = {};
bodyCard.id = 'id0';
bodyCard.cardBrand = 'INTERAC';
bodyCard.last4 = 'last_42';
bodyCard.expMonth = 236;
bodyCard.expYear = 60;
bodyCard.cardholderName = 'Amelia Earhart';
bodyCard.billingAddress = bodyCardBillingAddress;
bodyCard.customerId = 'VDKXEEKPJN48QDG3BGGFAK05P8';
bodyCard.referenceId = 'user-id-1';

const body: CreateCardRequest = {
idempotencyKey: '4935a656-a929-4792-b97c-8848be85c27c',
sourceId: 'cnon:uIbfJXhXETSP197M3GB',
card: bodyCard,
};
body.verificationToken = 'verification_token0';

try {
const { result, ...httpResponse } = await cardsApi.createCard(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```


# Retrieve Card

Retrieves details for a specific Card.

```ts
async retrieveCard(
cardId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveCardResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `cardId` | `string` | Template, Required | Unique ID for the desired Card. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`RetrieveCardResponse`](/doc/models/retrieve-card-response.md)

## Example Usage

```ts
const cardId = 'card_id4';
try {
const { result, ...httpResponse } = await cardsApi.retrieveCard(cardId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```


# Disable Card

Disables the card, preventing any further updates or charges.
Disabling an already disabled card is allowed but has no effect.

```ts
async disableCard(
cardId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<DisableCardResponse>>
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `cardId` | `string` | Template, Required | Unique ID for the desired Card. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type

[`DisableCardResponse`](/doc/models/disable-card-response.md)

## Example Usage

```ts
const cardId = 'card_id4';
try {
const { result, ...httpResponse } = await cardsApi.disableCard(cardId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
```

Loading

0 comments on commit 7324040

Please sign in to comment.