Skip to content

Commit

Permalink
API Updates for beta branch (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe committed Aug 25, 2022
1 parent a9e6a6d commit 14de2a1
Show file tree
Hide file tree
Showing 33 changed files with 3,782 additions and 182 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 21.3.0 - 2022-08-23
* [#1422](https://github.com/stripe/stripe-java/pull/1422) API Updates
* Add support for new resource `CustomerCashBalanceTransaction`
* Remove support for value `paypal` from enums `OrderCreateParams.payment.settings.payment_method_types[]` and `OrderUpdateParams.payment.settings.payment_method_types[]`
* Add support for `currency` on `PaymentLink`
* Add support for `network` on `SetupIntentConfirmParams.payment_method_options.card`, `SetupIntentCreateParams.payment_method_options.card`, `SetupIntentUpdateParams.payment_method_options.card`, `Subscription.payment_settings.payment_method_options.card`, `SubscriptionCreateParams.payment_settings.payment_method_options.card`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.card`
* Change `TreasuryOutboundTransferCreateParams.destination_payment_method` to be optional
* Add support for new value `customer_cash_balance_transaction.created` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`
* Change the return type of `Customer.fundCashBalance` test helper from `CustomerBalanceTransaction` to `CustomerCashBalanceTransaction`.
* This would generally be considered a breaking change, but we've worked with all existing users to migrate and are comfortable releasing this as a minor as it is solely a test helper method. This was essentially broken prior to this change.
* [#1425](https://github.com/stripe/stripe-java/pull/1425) Add beta readme.md section
* [#1423](https://github.com/stripe/stripe-java/pull/1423) chore: Remove unused variable from SearchPagingIteratorTest.
* [#1421](https://github.com/stripe/stripe-java/pull/1421) Add a support section to the readme
* [#1420](https://github.com/stripe/stripe-java/pull/1420) Fix outdated test comment
* [#1418](https://github.com/stripe/stripe-java/pull/1418) Fix latest JAR hyperlink and related tests
* [#1419](https://github.com/stripe/stripe-java/pull/1419) Fix makefile indentation and improve regex

## 21.3.0-beta.2 - 2022-08-23
* [#1426](https://github.com/stripe/stripe-java/pull/1426) API Updates for beta branch
- Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v183
v185
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.stripe/stripe-java)](https://mvnrepository.com/artifact/com.stripe/stripe-java)
[![JavaDoc](http://img.shields.io/badge/javadoc-reference-blue.svg)](https://stripe.dev/stripe-java)
[![Build Status](https://github.com/stripe/stripe-java/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-java/actions?query=branch%3Amaster)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-java/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-java?branch=master)

The official [Stripe][stripe] Java client library.

## Support

New features and bug fixes are released on the latest major version of the Stripe Java client library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

## Installation

### Requirements
Expand Down Expand Up @@ -80,7 +77,7 @@ public class StripeExample {

public static void main(String[] args) {
Stripe.apiKey = "sk_test_...";

CustomerCreateParams params =
CustomerCreateParams
.builder()
Expand Down Expand Up @@ -242,6 +239,30 @@ You can disable this behavior if you prefer:
Stripe.enableTelemetry = false;
```

### Beta SDKs

Stripe has features in the beta phase that can be accessed via the beta version of this package.
We would love for you to try these and share feedback with us before these features reach the stable phase.
To install a beta version of stripe-java follow steps [installation steps above](#installation) using the beta library version.

> **Note**
> There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific version. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.
We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.

If your beta feature requires a `Stripe-Version` header to be sent, use the `Stripe.stripeVersion` field to set it:

> **Note**
> The `stripeVersion` can only be set in beta versions of the library.
```java
Stripe.stripeVersion += "; feature_beta=v3";
```

## Support

New features and bug fixes are released on the latest major version of the Stripe Java client library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

## Development

JDK 18 is required to build the Stripe Java library. By default, tests use the same Java runtime as the build.
Expand Down
146 changes: 0 additions & 146 deletions src/main/java/com/stripe/model/CashBalance.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,39 +124,6 @@ public CashBalance update(CashBalanceUpdateParams params, RequestOptions options
ApiResource.RequestMethod.POST, url, params, CashBalance.class, options);
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AppliedToPaymentTransaction extends StripeObject {
/**
* The <a href="https://stripe.com/docs/api/payment_intents/object">Payment Intent</a> that
* funds were applied to.
*/
@SerializedName("payment_intent")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<PaymentIntent> paymentIntent;

/** Get ID of expandable {@code paymentIntent} object. */
public String getPaymentIntent() {
return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
}

public void setPaymentIntent(String id) {
this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
}

/** Get expanded {@code paymentIntent}. */
public PaymentIntent getPaymentIntentObject() {
return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
}

public void setPaymentIntentObject(PaymentIntent expandableObject) {
this.paymentIntent =
new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand All @@ -169,117 +136,4 @@ public static class BalanceSettings extends StripeObject {
@SerializedName("reconciliation_mode")
String reconciliationMode;
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class FundedTransaction extends StripeObject {
@SerializedName("bank_transfer")
BankTransfer bankTransfer;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class BankTransfer extends StripeObject {
@SerializedName("eu_bank_transfer")
EuBankTransfer euBankTransfer;

/** The user-supplied reference field on the bank transfer. */
@SerializedName("reference")
String reference;

/**
* The funding method type used to fund the customer balance. Permitted values include: {@code
* eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, or {@code
* mx_bank_transfer}.
*
* <p>One of {@code eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, or
* {@code mx_bank_transfer}.
*/
@SerializedName("type")
String type;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class EuBankTransfer extends StripeObject {
/** The BIC of the bank of the sender of the funding. */
@SerializedName("bic")
String bic;

/** The last 4 digits of the IBAN of the sender of the funding. */
@SerializedName("iban_last4")
String ibanLast4;

/** The full name of the sender, as supplied by the sending bank. */
@SerializedName("sender_name")
String senderName;
}
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class RefundedFromPaymentTransaction extends StripeObject {
/**
* The <a href="https://stripe.com/docs/api/refunds/object">Refund</a> that moved these funds
* into the customer's cash balance.
*/
@SerializedName("refund")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Refund> refund;

/** Get ID of expandable {@code refund} object. */
public String getRefund() {
return (this.refund != null) ? this.refund.getId() : null;
}

public void setRefund(String id) {
this.refund = ApiResource.setExpandableFieldId(id, this.refund);
}

/** Get expanded {@code refund}. */
public Refund getRefundObject() {
return (this.refund != null) ? this.refund.getExpanded() : null;
}

public void setRefundObject(Refund expandableObject) {
this.refund = new ExpandableField<Refund>(expandableObject.getId(), expandableObject);
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class UnappliedFromPaymentTransaction extends StripeObject {
/**
* The <a href="https://stripe.com/docs/api/payment_intents/object">Payment Intent</a> that
* funds were unapplied from.
*/
@SerializedName("payment_intent")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<PaymentIntent> paymentIntent;

/** Get ID of expandable {@code paymentIntent} object. */
public String getPaymentIntent() {
return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
}

public void setPaymentIntent(String id) {
this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
}

/** Get expanded {@code paymentIntent}. */
public PaymentIntent getPaymentIntentObject() {
return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
}

public void setPaymentIntentObject(PaymentIntent expandableObject) {
this.paymentIntent =
new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
}
}
}
20 changes: 14 additions & 6 deletions src/main/java/com/stripe/model/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,13 +824,13 @@ private TestHelpers(Customer resource) {
}

/** Create an incoming testmode bank transfer. */
public CustomerBalanceTransaction fundCashBalance(Map<String, Object> params)
public CustomerCashBalanceTransaction fundCashBalance(Map<String, Object> params)
throws StripeException {
return fundCashBalance(params, (RequestOptions) null);
}

/** Create an incoming testmode bank transfer. */
public CustomerBalanceTransaction fundCashBalance(
public CustomerCashBalanceTransaction fundCashBalance(
Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
Expand All @@ -840,17 +840,21 @@ public CustomerBalanceTransaction fundCashBalance(
"/v1/test_helpers/customers/%s/fund_cash_balance",
ApiResource.urlEncodeId(this.resource.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options);
ApiResource.RequestMethod.POST,
url,
params,
CustomerCashBalanceTransaction.class,
options);
}

/** Create an incoming testmode bank transfer. */
public CustomerBalanceTransaction fundCashBalance(CustomerFundCashBalanceParams params)
public CustomerCashBalanceTransaction fundCashBalance(CustomerFundCashBalanceParams params)
throws StripeException {
return fundCashBalance(params, (RequestOptions) null);
}

/** Create an incoming testmode bank transfer. */
public CustomerBalanceTransaction fundCashBalance(
public CustomerCashBalanceTransaction fundCashBalance(
CustomerFundCashBalanceParams params, RequestOptions options) throws StripeException {
String url =
String.format(
Expand All @@ -860,7 +864,11 @@ public CustomerBalanceTransaction fundCashBalance(
"/v1/test_helpers/customers/%s/fund_cash_balance",
ApiResource.urlEncodeId(this.resource.getId())));
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options);
ApiResource.RequestMethod.POST,
url,
params,
CustomerCashBalanceTransaction.class,
options);
}
}
}

0 comments on commit 14de2a1

Please sign in to comment.