diff --git a/CHANGES.md b/CHANGES.md
index c902bbf..494fe69 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,5 +1,11 @@
# Change Log
+## Version 2.3.1 (2017-09-15)
+
+### New features: Charge Orders
+
+* `Charge` endpoint can charge a specific Order.
+
## Version 2.3.0 (2017-09-13)
### New features: Orders API
diff --git a/README.md b/README.md
index 8ca8304..f48f79e 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Add this dependency to your project's POM:
com.squareup
connect
- 2.3.0
+ 2.3.1
compile
```
@@ -28,7 +28,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:
```groovy
-compile "com.squareup:connect:2.3.0"
+compile "com.squareup:connect:2.3.1"
```
### Build and Install locally
@@ -47,7 +47,7 @@ At first generate the JAR by executing:
Then manually install the following JARs:
-* target/connect-2.3.0.jar
+* target/connect-2.3.1.jar
* target/lib/*.jar
## Getting Started
diff --git a/build.gradle b/build.gradle
index e43f93b..e5dfa54 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.squareup'
-version = '2.3.0'
+version = '2.3.1'
buildscript {
repositories {
diff --git a/docs/ChargeRequest.md b/docs/ChargeRequest.md
index 2037bf4..5ed2f0b 100644
--- a/docs/ChargeRequest.md
+++ b/docs/ChargeRequest.md
@@ -15,6 +15,7 @@ Name | Type | Description | Notes
**billingAddress** | [**Address**](Address.md) | The buyer's billing address. This value is optional, but this transaction is ineligible for chargeback protection if neither this parameter nor `shipping_address` is provided. | [optional]
**shippingAddress** | [**Address**](Address.md) | The buyer's shipping address, if available. This value is optional, but this transaction is ineligible for chargeback protection if neither this parameter nor `billing_address` is provided. | [optional]
**buyerEmailAddress** | **String** | The buyer's email address, if available. This value is optional, but this transaction is ineligible for chargeback protection if it is not provided. | [optional]
+**orderId** | **String** | The ID of the order to associate with this transaction. If you provide this value, the `amount_money` value of your request must __exactly match__ the `total_money` value of the order's `order_amounts` field. | [optional]
diff --git a/docs/OrdersApi.md b/docs/OrdersApi.md
index 96e9974..45edb98 100644
--- a/docs/OrdersApi.md
+++ b/docs/OrdersApi.md
@@ -69,7 +69,7 @@ Name | Type | Description | Notes
CreateOrder
-Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](https://docs.connect.squareup.com/articles/orders-overview).
+Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](https://docs.connect.squareup.com/articles/orders-api-overview).
### Example
```java
diff --git a/pom.xml b/pom.xml
index b345256..83651a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
connect
jar
connect
- 2.3.0
+ 2.3.1
https://github.com/square/connect-java-sdk/
Java client library for the Square Connect API
diff --git a/src/main/java/com/squareup/connect/ApiClient.java b/src/main/java/com/squareup/connect/ApiClient.java
index bc441be..a03a543 100644
--- a/src/main/java/com/squareup/connect/ApiClient.java
+++ b/src/main/java/com/squareup/connect/ApiClient.java
@@ -73,7 +73,7 @@ public ApiClient() {
this.dateFormat = new RFC3339DateFormat();
// Set default User-Agent.
- setUserAgent("Square-Connect-Java/2.3.0");
+ setUserAgent("Square-Connect-Java/2.3.1");
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap();
diff --git a/src/main/java/com/squareup/connect/api/OrdersApi.java b/src/main/java/com/squareup/connect/api/OrdersApi.java
index 224767b..8880516 100644
--- a/src/main/java/com/squareup/connect/api/OrdersApi.java
+++ b/src/main/java/com/squareup/connect/api/OrdersApi.java
@@ -138,7 +138,7 @@ public BatchRetrieveOrdersResponse batchRetrieveOrders(String locationId, BatchR
}
/**
* CreateOrder
- * Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](https://docs.connect.squareup.com/articles/orders-overview).
+ * Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](https://docs.connect.squareup.com/articles/orders-api-overview).
* @param locationId The ID of the business location to associate the order with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateOrderResponse
@@ -188,7 +188,7 @@ public CreateOrderResponse createOrder(String locationId, CreateOrderRequest bod
/**
* CreateOrder
- * Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](https://docs.connect.squareup.com/articles/orders-overview).
+ * Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](https://docs.connect.squareup.com/articles/orders-api-overview).
* @param locationId The ID of the business location to associate the order with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
diff --git a/src/main/java/com/squareup/connect/models/ChargeRequest.java b/src/main/java/com/squareup/connect/models/ChargeRequest.java
index 3c2ee9d..c67e333 100644
--- a/src/main/java/com/squareup/connect/models/ChargeRequest.java
+++ b/src/main/java/com/squareup/connect/models/ChargeRequest.java
@@ -61,6 +61,9 @@ public class ChargeRequest {
@JsonProperty("buyer_email_address")
private String buyerEmailAddress = null;
+ @JsonProperty("order_id")
+ private String orderId = null;
+
public ChargeRequest idempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
return this;
@@ -259,6 +262,24 @@ public void setBuyerEmailAddress(String buyerEmailAddress) {
this.buyerEmailAddress = buyerEmailAddress;
}
+ public ChargeRequest orderId(String orderId) {
+ this.orderId = orderId;
+ return this;
+ }
+
+ /**
+ * The ID of the order to associate with this transaction. If you provide this value, the `amount_money` value of your request must __exactly match__ the `total_money` value of the order's `order_amounts` field.
+ * @return orderId
+ **/
+ @ApiModelProperty(value = "The ID of the order to associate with this transaction. If you provide this value, the `amount_money` value of your request must __exactly match__ the `total_money` value of the order's `order_amounts` field.")
+ public String getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(String orderId) {
+ this.orderId = orderId;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -279,12 +300,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.customerId, chargeRequest.customerId) &&
Objects.equals(this.billingAddress, chargeRequest.billingAddress) &&
Objects.equals(this.shippingAddress, chargeRequest.shippingAddress) &&
- Objects.equals(this.buyerEmailAddress, chargeRequest.buyerEmailAddress);
+ Objects.equals(this.buyerEmailAddress, chargeRequest.buyerEmailAddress) &&
+ Objects.equals(this.orderId, chargeRequest.orderId);
}
@Override
public int hashCode() {
- return Objects.hash(idempotencyKey, amountMoney, cardNonce, customerCardId, delayCapture, referenceId, note, customerId, billingAddress, shippingAddress, buyerEmailAddress);
+ return Objects.hash(idempotencyKey, amountMoney, cardNonce, customerCardId, delayCapture, referenceId, note, customerId, billingAddress, shippingAddress, buyerEmailAddress, orderId);
}
@@ -304,6 +326,7 @@ public String toString() {
sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n");
sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n");
sb.append(" buyerEmailAddress: ").append(toIndentedString(buyerEmailAddress)).append("\n");
+ sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n");
sb.append("}");
return sb.toString();
}