Skip to content

Commit

Permalink
Make AppInfo public (#1133)
Browse files Browse the repository at this point in the history
Fixes #1131
  • Loading branch information
mshafrir-stripe authored Jun 20, 2019
1 parent 223017d commit d9630d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.jakewharton.rxbinding2.view.RxView;
import com.stripe.android.ApiResultCallback;
import com.stripe.android.AppInfo;
import com.stripe.android.CustomerSession;
import com.stripe.android.PayWithGoogleUtils;
import com.stripe.android.PaymentConfiguration;
Expand Down Expand Up @@ -89,6 +90,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);

Stripe.setAppInfo(AppInfo.create("MyAwesomePlugin", "1.2.34",
"https://myawesomeplugin.info", "pp_partner_1234"));
mStripe = new Stripe(this, PaymentConfiguration.getInstance().getPublishableKey());
mService = RetrofitFactory.getInstance().create(StripeService.class);

Expand Down Expand Up @@ -324,8 +327,8 @@ private void processPaymentIntent(@NonNull PaymentIntent paymentIntent) {
mEnterPaymentInfo.setText(getString(R.string.add_credit_card));
mEnterShippingInfo.setText(getString(R.string.add_shipping_details));
} else {
displayError(
"Unhandled Payment Intent Status: " + paymentIntent.getStatus().toString());
displayError("Unhandled Payment Intent Status: " +
Objects.requireNonNull(paymentIntent.getStatus()).toString());
}
}

Expand Down
13 changes: 7 additions & 6 deletions stripe/src/main/java/com/stripe/android/AppInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,31 @@
* See <a href="https://stripe.com/docs/building-plugins#setappinfo">
* https://stripe.com/docs/building-plugins#setappinfo</a>.
*/
final class AppInfo {
public final class AppInfo {
@NonNull private final String mName;
@Nullable private final String mVersion;
@Nullable private final String mUrl;
@Nullable private final String mPartnerId;

@NonNull
static AppInfo create(@NonNull String name) {
public static AppInfo create(@NonNull String name) {
return new AppInfo(name, null, null, null);
}

@NonNull
static AppInfo create(@NonNull String name, @NonNull String version) {
public static AppInfo create(@NonNull String name, @NonNull String version) {
return new AppInfo(name, version, null, null);
}

@NonNull
static AppInfo create(@NonNull String name, @NonNull String version, @NonNull String url) {
public static AppInfo create(@NonNull String name, @NonNull String version,
@NonNull String url) {
return new AppInfo(name, version, url, null);
}

@NonNull
static AppInfo create(@NonNull String name, @NonNull String version, @NonNull String url,
@NonNull String partnerId) {
public static AppInfo create(@NonNull String name, @NonNull String version, @NonNull String url,
@NonNull String partnerId) {
return new AppInfo(name, version, url, partnerId);
}

Expand Down

0 comments on commit d9630d6

Please sign in to comment.