Skip to content

Commit

Permalink
Merge pull request #65 from square/release/16.0.0.20211020
Browse files Browse the repository at this point in the history
Generated PR for Release: 16.0.0.20211020
  • Loading branch information
Wolfgang Schuster authored Oct 20, 2021
2 parents 2572f52 + 380f646 commit dc02d72
Show file tree
Hide file tree
Showing 107 changed files with 1,708 additions and 1,307 deletions.
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# configuration settings for labeler

version: v1
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,22 @@ jobs:
distribution: "adopt"
- name: Build with Maven
run: mvn test -B

labeler:
needs: build
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: automerge-labeler
uses: fuxingloh/multi-labeler@v1

automerge:
needs: labeler
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "automerge,automerge-branch,automerge-author"
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# Change Log

## Version 16.0.0.20211020 (2021-10-20)
## API updates
* **Transactions API.** Three previously deprecated endpoints (`ListRefunds`, `Charge`, and `CreateRefund`) in the [Transactions API](https://developer.squareup.com/reference/square_2021-10-20/transactions-api) are removed from Square API version 2021-10-20 and later. These endpoints will work if you are using Square API versions prior to 2021-10-20. However, these endpoints will eventually be retired from all Square versions.

* Instead of the Transactions API `Charge` endpoint, use the Payments API [CreatePayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment) endpoint.
* Instead of the Transactions API `CreateRefund` endpoint, use the Refunds API [RefundPayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/refund-payment) endpoint.
* Instead of the Transactions API `ListRefunds` endpoint, use the Refunds API [ListPaymentRefund](https://developer.squareup.com/reference/square_2021-10-20/payments-api/list-payment-refunds) endpoint.

* **Payments API:**
* [Payment](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment) object.
* Added the [device_details](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-device_details) read-only field to view details of the device used to take a payment. This `Payment`-level field provides device information for all types of payments. Previously, device details were only available for card payments (`Payment.card_details.device_details`), which is now deprecated.
* Added the [team_member_id](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-team_member_id) that applications can use to view the ID of the [TeamMember](https://developer.squareup.com/reference/square_2021-10-20/objects/TeamMember) associated with the payment. Use this field instead of the `Payment.employee_id` field, which is now deprecated.
* Added the [application_details](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-application_details) read-only field to view details of the application that took the payment.

* These `Payment` fields have moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle) (GA) state:[tip_money](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-tip_money), [delay_duration](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delay_duration), [statement_description_identifier](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-statement_description_identifier), [delay_duration](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delay_duration), [delay_action](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delay_action), [delayed_until](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delayed_until), and [statement_description_identifier](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-statement_description_identifier).

* The [ACH Bank Transfer Payments](https://developer.squareup.com/docs/payments-api/take-payments/ach-payments) feature has moved to the GA state. Accordingly, the [bank_account_details](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-bank_account_details) field (and its [BankAccountPaymentDetails](https://developer.squareup.com/reference/square_2021-10-20/objects/BankAccountPaymentDetails) type) are moved to the GA state.
* [CreatePayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment) endpoint.
* Added the [team_member_id](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment#request__property-team_member_id) request field to record the ID of the team member associated with the payment.
* The [accept_partial_authorization](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment#request__property-accept_partial_authorization) request field has moved to the GA state.
* [CompletePayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/complete-payment) endpoint. Added the `version_token` request field to support optimistic concurrency. For more information, see [Delayed capture of a card payment.](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment)

* **Refunds API:**
* [RefundPayment](https://developer.squareup.com/reference/square_2021-10-20/refunds-api/refund-payment) endpoint.
* Added the `team_member_id` request field to record the ID of the team member associated with the refund.
* Added the `payment_version_token` request field to support optimistic concurrency. For more information, see [Refund Payment.](https://developer.squareup.com/docs/payments-api/refund-payments#optimistic-concurrency)

* **Customers API:**
* [Customer](https://developer.squareup.com/reference/square_2021-10-20/objects/Customer) object. Added a new `tax_ids` field of the [CustomerTaxIds](https://developer.squareup.com/reference/square_2021-10-20/objects/CustomerTaxIds) type, which can contain the EU VAT ID of the customer. This field is available only for customers of sellers in France, Ireland, or the United Kingdom. For more information, see [Customer tax IDs.](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids)

* [UpdateCustomer](https://developer.squareup.com/reference/square_2021-10-20/customers-api/update-customer) endpoint. The Customers API now returns a `400 BAD_REQUEST` error if the request body does not contain any fields. For earlier Square versions, the Customers API will continue to return a `200 OK` response along with the customer profile. For more information, see [Migration notes.](https://developer.squareup.com/docs/customers-api/what-it-does#migration-notes)

* **Invoices API:**
* [InvoiceRecipient](https://developer.squareup.com/reference/square_2021-10-20/objects/InvoiceRecipient) object. Added a new, read-only `tax_ids` field of the [InvoiceRecipientTaxIds](https://developer.squareup.com/reference/square_2021-10-20/objects/InvoiceRecipientTaxIds) type, which can contain the EU VAT ID of the invoice recipient. This field is available only for customers of sellers in Ireland or the United Kingdom. If defined, `tax_ids` is returned for all Square API versions. For more information, see [Invoice recipient tax IDs.](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids)
* Square now sends emails for test invoices that are published in the Sandbox environment.

* **Catalog API:**
* [CatalogSubscriptionPlan.name](https://developer.squareup.com/reference/square_2021-10-20/objects/CatalogSubscriptionPlan#definition__property-name) can be updated after the subscription plan is created. The change is retroactively applicable to prior versions of the Square API.

* **Subscriptions API:**
* The new [SubscriptionSource](https://developer.squareup.com/reference/square_2021-10-20/objects/SubscriptionSource) data type is introduced to encapsulate the source where a subscription is created. The new `SubscriptionSource.name` value is propagated to the `Order.source` attribute when an order is made on the subscription. The new feature is retroactively applicable to prior versions of the Square API.
* The new [Subscription.source](https://developer.squareup.com/reference/square_2021-10-20/objects/Subscription#definition__property-source) attribute is introduced to indicate the source where the subscription was created. This new feature is retroactively applicable to prior versions of the Square API.
* The new [SearchSubscriptionsFilter.source_names](https://developer.squareup.com/reference/square_2021-10-20/objects/SearchSubscriptionFilter#definition__property-source_names) query expression is introduced to enable search for subscriptions by the subscription source name. This new feature is retroactively applicable to prior versions of the Square API.


## Version 15.1.0.20210915 (2021-09-15)
## API updates

Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Install the client dynamically by adding a dependency to the POM for your projec
<dependency>
<groupId>com.squareup</groupId>
<artifactId>square</artifactId>
<version>15.1.0.20210915</version>
<version>16.0.0.20211020</version>
</dependency>
```

Expand All @@ -42,7 +42,7 @@ Install the client dynamically by adding a dependency to the POM for your projec
Install the client by adding the following dependency to the build file for your project:

```
implementation "com.squareup:square:15.1.0.20210915"
implementation "com.squareup:square:16.0.0.20211020"
```

## API documentation
Expand Down Expand Up @@ -114,6 +114,16 @@ implementation "com.squareup:square:15.1.0.20210915"
* [V1 Items]
* [Transactions]

#### Usage Notes for V1 Transactions

The Square API supersedes the legacy Connect V1 APIs. Square strongly discourages using Connect V1 for most use cases. However, you must still use Connect V1 for listing settlements and listing payments. For more information, see [When to Use Connect V1](https://developer.squareup.com/docs/build-basics/using-connect-v1.html).

In the Square Java SDK, the [`V1TransactionsApi`](https://github.com/square/square-java-sdk/blob/master/doc/api/v1-transactions.md) class provides [`ListSettlements`](https://github.com/square/square-java-sdk/blob/master/doc/api/v1-transactions.md#list-settlements) and [`ListPayments`](https://github.com/square/square-java-sdk/blob/master/doc/api/v1-transactions.md#list-payments) for accessing these Connect V1 endpoints. However, Square has identified an issue that prevents these methods from returning results. There is no workaround for this issue.

If you need to use [List settlements](https://developer.squareup.com/reference/square/settlements-api/v1-list-settlements) or [List payments](https://developer.squareup.com/reference/square/settlements-api/v1-list-payments), you should send HTTP ```GET``` requests directly to these Connect V1 endpoints. The response body consists of a JSON list of objects, which you can process as needed.

You'll also need to provide logic to handle paginated results. For more information, see [Pagination in Connect V1](https://developer.squareup.com/docs/working-with-apis/pagination#pagination-in-connect-v1).

## Usage

First time using Square? Here’s how to get started:
Expand Down
2 changes: 1 addition & 1 deletion doc/api/devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CompletableFuture<CreateDeviceCodeResponse> createDeviceCodeAsync(

```java
DeviceCode bodyDeviceCode = new DeviceCode.Builder(
"TERMINAL_API")
null)
.id("id0")
.name("Counter 1")
.code("code8")
Expand Down
2 changes: 1 addition & 1 deletion doc/api/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ InvoiceFilter bodyQueryFilter = new InvoiceFilter.Builder(
.customerIds(bodyQueryFilterCustomerIds)
.build();
InvoiceSort bodyQuerySort = new InvoiceSort.Builder(
"INVOICE_SORT_DATE")
null)
.order("DESC")
.build();
InvoiceQuery bodyQuery = new InvoiceQuery.Builder(
Expand Down
25 changes: 15 additions & 10 deletions doc/api/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CompletableFuture<CreatePaymentResponse> createPaymentAsync(

```java
Money bodyAmountMoney = new Money.Builder()
.amount(200L)
.amount(1000L)
.currency("USD")
.build();
Money bodyTipMoney = new Money.Builder()
Expand All @@ -123,16 +123,16 @@ Money bodyAppFeeMoney = new Money.Builder()
.currency("USD")
.build();
CreatePaymentRequest body = new CreatePaymentRequest.Builder(
"ccof:uIbfJXhXETSP197M3GB",
"4935a656-a929-4792-b97c-8848be85c27c",
"ccof:GaJGNaZa8x4OgDJn4GB",
"7b0f3ec5-086a-4871-8f13-3c81b3875218",
bodyAmountMoney)
.tipMoney(bodyTipMoney)
.appFeeMoney(bodyAppFeeMoney)
.delayDuration("delay_duration6")
.autocomplete(true)
.orderId("order_id0")
.customerId("VDKXEEKPJN48QDG3BGGFAK05P8")
.locationId("XK3DBG77NJBFX")
.customerId("W92WH6P11H4Z77CTET0RNTGFW8")
.locationId("L88917AVBK2S5")
.referenceId("123456")
.note("Brief description")
.build();
Expand Down Expand Up @@ -255,7 +255,7 @@ Money bodyPaymentAmountMoney = new Money.Builder()
.currency("USD")
.build();
Money bodyPaymentTipMoney = new Money.Builder()
.amount(300L)
.amount(100L)
.currency("USD")
.build();
Payment bodyPayment = new Payment.Builder()
Expand All @@ -264,10 +264,10 @@ Payment bodyPayment = new Payment.Builder()
.updatedAt("updated_at8")
.amountMoney(bodyPaymentAmountMoney)
.tipMoney(bodyPaymentTipMoney)
.versionToken("Z3okDzm2VRv5m5nE3WGx381ItTNhvjkB4VapByyz54h6o")
.versionToken("ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o")
.build();
UpdatePaymentRequest body = new UpdatePaymentRequest.Builder(
"3d3c3b22-9572-4fc6-1111-e4d2f41b4122")
"956f8b13-e4ec-45d6-85e8-d1d95ef0c5de")
.payment(bodyPayment)
.build();

Expand Down Expand Up @@ -323,14 +323,16 @@ You can use this endpoint to complete a payment with the APPROVED `status`.

```java
CompletableFuture<CompletePaymentResponse> completePaymentAsync(
final String paymentId)
final String paymentId,
final CompletePaymentRequest body)
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `paymentId` | `String` | Template, Required | The unique ID identifying the payment to be completed. |
| `body` | [`CompletePaymentRequest`](/doc/models/complete-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |

## Response Type

Expand All @@ -340,8 +342,11 @@ CompletableFuture<CompletePaymentResponse> completePaymentAsync(

```java
String paymentId = "payment_id0";
CompletePaymentRequest body = new CompletePaymentRequest.Builder()
.versionToken("version_token2")
.build();

paymentsApi.completePaymentAsync(paymentId).thenAccept(result -> {
paymentsApi.completePaymentAsync(paymentId, body).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
Expand Down
14 changes: 8 additions & 6 deletions doc/api/refunds.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,21 @@ CompletableFuture<RefundPaymentResponse> refundPaymentAsync(

```java
Money bodyAmountMoney = new Money.Builder()
.amount(100L)
.amount(1000L)
.currency("USD")
.build();
Money bodyAppFeeMoney = new Money.Builder()
.amount(114L)
.currency("GEL")
.amount(10L)
.currency("USD")
.build();
RefundPaymentRequest body = new RefundPaymentRequest.Builder(
"a7e36d40-d24b-11e8-b568-0800200c9a66",
"9b7f2dcf-49da-4411-b23e-a2d6af21333a",
bodyAmountMoney,
"UNOE3kv2BZwqHlJ830RCt5YCuaB")
"R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY")
.appFeeMoney(bodyAppFeeMoney)
.reason("reason8")
.reason("Example")
.paymentVersionToken("payment_version_token6")
.teamMemberId("team_member_id4")
.build();

refundsApi.refundPaymentAsync(body).thenAccept(result -> {
Expand Down
9 changes: 8 additions & 1 deletion doc/api/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,21 @@ Money bodyPriceOverrideMoney = new Money.Builder()
.amount(100L)
.currency("USD")
.build();
SubscriptionSource bodySource = new SubscriptionSource.Builder()
.name("My App")
.build();
CreateSubscriptionRequest body = new CreateSubscriptionRequest.Builder(
"S8GWD5R9QB376",
"6JHXF3B2CW3YKHDV4XEM674H",
"CHFGVKYY8RSV93M5KCYTG4PN0G")
.idempotencyKey("8193148c-9586-11e6-99f9-28cfe92138cf")
.startDate("2020-08-01")
.startDate("2021-10-20")
.canceledDate("canceled_date0")
.taxPercentage("5")
.priceOverrideMoney(bodyPriceOverrideMoney)
.cardId("ccof:qy5x8hHGYsgLrp4Q4GB")
.timezone("America/Los_Angeles")
.source(bodySource)
.build();

subscriptionsApi.createSubscriptionAsync(body).thenAccept(result -> {
Expand Down Expand Up @@ -113,9 +117,12 @@ List<String> bodyQueryFilterCustomerIds = new LinkedList<>();
bodyQueryFilterCustomerIds.add("CHFGVKYY8RSV93M5KCYTG4PN0G");
List<String> bodyQueryFilterLocationIds = new LinkedList<>();
bodyQueryFilterLocationIds.add("S8GWD5R9QB376");
List<String> bodyQueryFilterSourceNames = new LinkedList<>();
bodyQueryFilterSourceNames.add("My App");
SearchSubscriptionsFilter bodyQueryFilter = new SearchSubscriptionsFilter.Builder()
.customerIds(bodyQueryFilterCustomerIds)
.locationIds(bodyQueryFilterLocationIds)
.sourceNames(bodyQueryFilterSourceNames)
.build();
SearchSubscriptionsQuery bodyQuery = new SearchSubscriptionsQuery.Builder()
.filter(bodyQueryFilter)
Expand Down
Loading

0 comments on commit dc02d72

Please sign in to comment.