From eb87edaf06b68850bd7ce639ba175a5deda70e78 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Tue, 19 Sep 2023 10:05:31 -0500 Subject: [PATCH 01/14] Add launcher --- .../demo/PreferredPaymentMethodsFragment.java | 2 +- .../braintreepayments/demo/VenmoFragment.java | 26 +++++++++-- .../braintreepayments/api/VenmoClient.java | 46 ++++++++++++++----- .../api/VenmoIntenDataCallback.java | 6 +++ .../api/VenmoIntentData.java | 2 +- .../braintreepayments/api/VenmoLauncher.java | 25 ++++++++++ .../braintreepayments/api/VenmoResult.java | 4 +- .../api/VenmoResultCallback.java | 6 +++ 8 files changed, 97 insertions(+), 20 deletions(-) create mode 100644 Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java create mode 100644 Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java create mode 100644 Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java diff --git a/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java b/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java index a22f42573d..ff4ab9c57e 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java @@ -108,6 +108,6 @@ public void launchVenmo(View v) { if (requestError != null) { handleError(requestError); } - }); + }, null); } } diff --git a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java index f2cf72a12f..03b6cc6551 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java @@ -16,16 +16,24 @@ import com.braintreepayments.api.BraintreeClient; import com.braintreepayments.api.VenmoAccountNonce; import com.braintreepayments.api.VenmoClient; +import com.braintreepayments.api.VenmoIntenDataCallback; +import com.braintreepayments.api.VenmoIntentData; +import com.braintreepayments.api.VenmoLauncher; import com.braintreepayments.api.VenmoLineItem; import com.braintreepayments.api.VenmoListener; import com.braintreepayments.api.VenmoPaymentMethodUsage; import com.braintreepayments.api.VenmoRequest; +import com.braintreepayments.api.VenmoResult; +import com.braintreepayments.api.VenmoResultCallback; + import java.util.ArrayList; public class VenmoFragment extends BaseFragment implements VenmoListener { private ImageButton venmoButton; private VenmoClient venmoClient; + + private VenmoLauncher venmoLauncher; private BraintreeClient braintreeClient; @Nullable @@ -35,9 +43,12 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c venmoButton = view.findViewById(R.id.venmo_button); venmoButton.setOnClickListener(this::launchVenmo); - braintreeClient = getBraintreeClient(); - venmoClient = new VenmoClient(this, braintreeClient); - venmoClient.setListener(this); + venmoLauncher = new VenmoLauncher(this, new VenmoResultCallback() { + @Override + public void onVenmoResult(VenmoAccountNonce venmoAccountNonce) { + onVenmoSuccess(venmoAccountNonce); + } + }); return view; } @@ -57,6 +68,8 @@ public void launchVenmo(View v) { boolean shouldVault = Settings.vaultVenmo(activity) && !TextUtils.isEmpty(Settings.getCustomerId(activity)); + braintreeClient = getBraintreeClient(); + venmoClient = new VenmoClient(this, braintreeClient); braintreeClient.getConfiguration((configuration, error) -> { if (venmoClient.isVenmoAppSwitchAvailable(activity)) { @@ -74,7 +87,12 @@ public void launchVenmo(View v) { lineItems.add(new VenmoLineItem(VenmoLineItem.KIND_DEBIT, "Two Items", 2, "10")); venmoRequest.setLineItems(lineItems); - venmoClient.tokenizeVenmoAccount(activity, venmoRequest); + venmoClient.tokenizeVenmoAccount(activity, venmoRequest, null, new VenmoIntenDataCallback() { + @Override + public void onVenmoIntentData(VenmoIntentData venmoIntentData) { + venmoLauncher.launch(venmoIntentData); + } + }); } else if (configuration.isVenmoEnabled()) { showDialog("Please install the Venmo app first."); } else { diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index 387bacd081..0dedcffe43 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -85,9 +85,9 @@ public VenmoClient(@NonNull BraintreeClient braintreeClient) { this.sharedPrefsWriter = sharedPrefsWriter; this.deviceInspector = deviceInspector; this.venmoApi = venmoApi; - if (activity != null && lifecycle != null) { - addObserver(activity, lifecycle); - } +// if (activity != null && lifecycle != null) { +// addObserver(activity, lifecycle); +// } } private void addObserver(@NonNull FragmentActivity activity, @NonNull Lifecycle lifecycle) { @@ -129,13 +129,19 @@ public void showVenmoInGooglePlayStore(@NonNull FragmentActivity activity) { */ public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request) { tokenizeVenmoAccount(activity, request, new VenmoTokenizeAccountCallback() { - @Override - public void onResult(@Nullable Exception error) { - if (error != null) { - listener.onVenmoFailure(error); - } - } - }); + @Override + public void onResult(@Nullable Exception error) { + if (error != null) { + listener.onVenmoFailure(error); + } + } + }, + new VenmoIntenDataCallback() { + @Override + public void onVenmoIntentData(VenmoIntentData venmoIntentData) { + // todo + } + }); } /** @@ -150,7 +156,7 @@ public void onResult(@Nullable Exception error) { * @param callback {@link VenmoTokenizeAccountCallback} */ @Deprecated - public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request, @NonNull final VenmoTokenizeAccountCallback callback) { + public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request, @NonNull final VenmoTokenizeAccountCallback callback, VenmoIntenDataCallback intentDataCallback) { braintreeClient.sendAnalyticsEvent("pay-with-venmo.selected"); braintreeClient.getConfiguration(new ConfigurationCallback() { @Override @@ -195,7 +201,7 @@ public void onResult(@Nullable final String paymentContextId, @Nullable Exceptio @Override public void onAuthorizationResult(@Nullable Authorization authorization, @Nullable Exception authError) { if (authorization != null) { - startVenmoActivityForResult(activity, request, configuration, authorization, finalVenmoProfileId, paymentContextId); + startVenmoActivityForResult(activity, request, configuration, authorization, finalVenmoProfileId, paymentContextId, intentDataCallback); } else { callback.onResult(authError); } @@ -231,6 +237,22 @@ private void startVenmoActivityForResult( } braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.started"); } + private void startVenmoActivityForResult( + final FragmentActivity activity, + final VenmoRequest request, + final Configuration configuration, + Authorization authorization, + final String venmoProfileId, + @Nullable final String paymentContextId, + VenmoIntenDataCallback callback + ) { + boolean isClientTokenAuth = (authorization instanceof ClientToken); + boolean shouldVault = request.getShouldVault() && isClientTokenAuth; + sharedPrefsWriter.persistVenmoVaultOption(activity, shouldVault); + VenmoIntentData intentData = new VenmoIntentData(configuration, venmoProfileId, paymentContextId, braintreeClient.getSessionId(), braintreeClient.getIntegrationType()); + callback.onVenmoIntentData(intentData); + braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.started"); + } void onVenmoResult(final VenmoResult venmoResult) { if (venmoResult.getError() == null) { diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java new file mode 100644 index 0000000000..23191ef4ae --- /dev/null +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java @@ -0,0 +1,6 @@ +package com.braintreepayments.api; + +public interface VenmoIntenDataCallback { + + void onVenmoIntentData(VenmoIntentData venmoIntentData); +} diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java index ce20bdbd70..491aaa5eb1 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java @@ -1,6 +1,6 @@ package com.braintreepayments.api; -class VenmoIntentData { +public class VenmoIntentData { private final Configuration configuration; private final String profileId; diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java new file mode 100644 index 0000000000..990a950546 --- /dev/null +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java @@ -0,0 +1,25 @@ +package com.braintreepayments.api; + + +import androidx.activity.result.ActivityResultCallback; +import androidx.activity.result.ActivityResultLauncher; +import androidx.fragment.app.Fragment; + +public class VenmoLauncher { + ActivityResultLauncher activityLauncher; + private static final String VENMO_SECURE_RESULT = "com.braintreepayments.api.Venmo.RESULT"; + + public VenmoLauncher(Fragment fragment, VenmoResultCallback callback) { + activityLauncher = fragment.getActivity().getActivityResultRegistry().register(VENMO_SECURE_RESULT, fragment.getViewLifecycleOwner(), new VenmoActivityResultContract(), new ActivityResultCallback() { + @Override + public void onActivityResult(VenmoResult venmoResult) { + VenmoAccountNonce nonce = new VenmoAccountNonce(venmoResult.getVenmoAccountNonce(), venmoResult.getVenmoUsername(), false); + callback.onVenmoResult(nonce); + } + }); + } + + public void launch(VenmoIntentData venmoIntentData) { + activityLauncher.launch(venmoIntentData); + } +} diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java index 8d0e5f5f06..c9fc027a3a 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java @@ -2,7 +2,7 @@ import androidx.annotation.Nullable; -class VenmoResult { +public class VenmoResult { private final Exception error; private final String paymentContextId; @@ -24,7 +24,7 @@ String getPaymentContextId() { return paymentContextId; } - String getVenmoAccountNonce() { + public String getVenmoAccountNonce() { return venmoAccountNonce; } diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java new file mode 100644 index 0000000000..942be997ae --- /dev/null +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java @@ -0,0 +1,6 @@ +package com.braintreepayments.api; + +public interface VenmoResultCallback { + + void onVenmoResult(VenmoAccountNonce venmoAccountNonce); +} From a21800a200e09ccb5c48415e815624abfe84f1ac Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Tue, 19 Sep 2023 10:26:12 -0500 Subject: [PATCH 02/14] Update result handling --- .../main/java/com/braintreepayments/demo/VenmoFragment.java | 5 +++-- .../src/main/java/com/braintreepayments/api/VenmoClient.java | 3 +-- .../main/java/com/braintreepayments/api/VenmoLauncher.java | 3 +-- .../src/main/java/com/braintreepayments/api/VenmoResult.java | 2 +- .../java/com/braintreepayments/api/VenmoResultCallback.java | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java index 03b6cc6551..7e81b5b302 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java @@ -45,8 +45,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c venmoLauncher = new VenmoLauncher(this, new VenmoResultCallback() { @Override - public void onVenmoResult(VenmoAccountNonce venmoAccountNonce) { - onVenmoSuccess(venmoAccountNonce); + public void onVenmoResult(VenmoResult venmoResult) { + venmoClient.onVenmoResult(venmoResult); } }); @@ -70,6 +70,7 @@ public void launchVenmo(View v) { Settings.vaultVenmo(activity) && !TextUtils.isEmpty(Settings.getCustomerId(activity)); braintreeClient = getBraintreeClient(); venmoClient = new VenmoClient(this, braintreeClient); + venmoClient.setListener(this); braintreeClient.getConfiguration((configuration, error) -> { if (venmoClient.isVenmoAppSwitchAvailable(activity)) { diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index 0dedcffe43..95fb7cf4aa 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -254,7 +254,7 @@ private void startVenmoActivityForResult( braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.started"); } - void onVenmoResult(final VenmoResult venmoResult) { + public void onVenmoResult(final VenmoResult venmoResult) { if (venmoResult.getError() == null) { braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.success"); @@ -267,7 +267,6 @@ public void onAuthorizationResult(@Nullable Authorization authorization, @Nullab String paymentContextId = venmoResult.getPaymentContextId(); if (paymentContextId != null) { venmoApi.createNonceFromPaymentContext(paymentContextId, new VenmoOnActivityResultCallback() { - @Override public void onResult(@Nullable VenmoAccountNonce nonce, @Nullable Exception error) { if (nonce != null) { boolean shouldVault = sharedPrefsWriter.getVenmoVaultOption(braintreeClient.getApplicationContext()); diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java index 990a950546..6381a50b75 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java @@ -13,8 +13,7 @@ public VenmoLauncher(Fragment fragment, VenmoResultCallback callback) { activityLauncher = fragment.getActivity().getActivityResultRegistry().register(VENMO_SECURE_RESULT, fragment.getViewLifecycleOwner(), new VenmoActivityResultContract(), new ActivityResultCallback() { @Override public void onActivityResult(VenmoResult venmoResult) { - VenmoAccountNonce nonce = new VenmoAccountNonce(venmoResult.getVenmoAccountNonce(), venmoResult.getVenmoUsername(), false); - callback.onVenmoResult(nonce); + callback.onVenmoResult(venmoResult); } }); } diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java index c9fc027a3a..370e226966 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java @@ -24,7 +24,7 @@ String getPaymentContextId() { return paymentContextId; } - public String getVenmoAccountNonce() { + String getVenmoAccountNonce() { return venmoAccountNonce; } diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java index 942be997ae..43ba70f9f6 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java @@ -2,5 +2,5 @@ public interface VenmoResultCallback { - void onVenmoResult(VenmoAccountNonce venmoAccountNonce); + void onVenmoResult(VenmoResult venmoResult); } From c5802329cab4c0f34b99ba288d9815e5ed6bbc59 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Tue, 19 Sep 2023 10:57:10 -0500 Subject: [PATCH 03/14] Cleanup client code --- .../braintreepayments/demo/VenmoFragment.java | 16 +++------------- .../com/braintreepayments/api/VenmoClient.java | 14 ++++++++++++-- .../com/braintreepayments/api/VenmoLauncher.java | 13 ++++++------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java index 7e81b5b302..3edd9fa41c 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java @@ -43,12 +43,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c venmoButton = view.findViewById(R.id.venmo_button); venmoButton.setOnClickListener(this::launchVenmo); - venmoLauncher = new VenmoLauncher(this, new VenmoResultCallback() { - @Override - public void onVenmoResult(VenmoResult venmoResult) { - venmoClient.onVenmoResult(venmoResult); - } - }); + venmoLauncher = new VenmoLauncher(this, venmoResult -> venmoClient.onVenmoResult(venmoResult)); return view; } @@ -69,7 +64,7 @@ public void launchVenmo(View v) { boolean shouldVault = Settings.vaultVenmo(activity) && !TextUtils.isEmpty(Settings.getCustomerId(activity)); braintreeClient = getBraintreeClient(); - venmoClient = new VenmoClient(this, braintreeClient); + venmoClient = new VenmoClient(braintreeClient); venmoClient.setListener(this); braintreeClient.getConfiguration((configuration, error) -> { @@ -88,12 +83,7 @@ public void launchVenmo(View v) { lineItems.add(new VenmoLineItem(VenmoLineItem.KIND_DEBIT, "Two Items", 2, "10")); venmoRequest.setLineItems(lineItems); - venmoClient.tokenizeVenmoAccount(activity, venmoRequest, null, new VenmoIntenDataCallback() { - @Override - public void onVenmoIntentData(VenmoIntentData venmoIntentData) { - venmoLauncher.launch(venmoIntentData); - } - }); + venmoClient.tokenizeVenmoAccount(activity, venmoRequest, venmoIntentData -> venmoLauncher.launch(venmoIntentData)); } else if (configuration.isVenmoEnabled()) { showDialog("Please install the Venmo app first."); } else { diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index 95fb7cf4aa..c95845e49c 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -144,6 +144,16 @@ public void onVenmoIntentData(VenmoIntentData venmoIntentData) { }); } + public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request, VenmoIntenDataCallback callback) { + tokenizeVenmoAccount(activity, request, new VenmoTokenizeAccountCallback() { + @Override + public void onResult(@Nullable Exception error) { + if (error != null) { + listener.onVenmoFailure(error); + } + } + }, callback); + } /** * Start the Pay With Venmo flow. This will app switch to the Venmo app. *

@@ -201,7 +211,7 @@ public void onResult(@Nullable final String paymentContextId, @Nullable Exceptio @Override public void onAuthorizationResult(@Nullable Authorization authorization, @Nullable Exception authError) { if (authorization != null) { - startVenmoActivityForResult(activity, request, configuration, authorization, finalVenmoProfileId, paymentContextId, intentDataCallback); + createVenmoIntentData(activity, request, configuration, authorization, finalVenmoProfileId, paymentContextId, intentDataCallback); } else { callback.onResult(authError); } @@ -237,7 +247,7 @@ private void startVenmoActivityForResult( } braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.started"); } - private void startVenmoActivityForResult( + private void createVenmoIntentData( final FragmentActivity activity, final VenmoRequest request, final Configuration configuration, diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java index 6381a50b75..70daeb8cfc 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java @@ -1,21 +1,20 @@ package com.braintreepayments.api; -import androidx.activity.result.ActivityResultCallback; import androidx.activity.result.ActivityResultLauncher; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; public class VenmoLauncher { ActivityResultLauncher activityLauncher; private static final String VENMO_SECURE_RESULT = "com.braintreepayments.api.Venmo.RESULT"; public VenmoLauncher(Fragment fragment, VenmoResultCallback callback) { - activityLauncher = fragment.getActivity().getActivityResultRegistry().register(VENMO_SECURE_RESULT, fragment.getViewLifecycleOwner(), new VenmoActivityResultContract(), new ActivityResultCallback() { - @Override - public void onActivityResult(VenmoResult venmoResult) { - callback.onVenmoResult(venmoResult); - } - }); + activityLauncher = fragment.getActivity().getActivityResultRegistry().register(VENMO_SECURE_RESULT, fragment.getViewLifecycleOwner(), new VenmoActivityResultContract(), callback::onVenmoResult); + } + + public VenmoLauncher(FragmentActivity activity, VenmoResultCallback callback) { + activityLauncher = activity.getActivityResultRegistry().register(VENMO_SECURE_RESULT, activity, new VenmoActivityResultContract(), callback::onVenmoResult); } public void launch(VenmoIntentData venmoIntentData) { From f37db6b9c362e9a158347da13f68d0c8a464bbc3 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Tue, 19 Sep 2023 11:38:31 -0500 Subject: [PATCH 04/14] Remove unused method --- .../main/java/com/braintreepayments/api/VenmoLauncher.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java index 70daeb8cfc..8d8eea3166 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java @@ -13,10 +13,6 @@ public VenmoLauncher(Fragment fragment, VenmoResultCallback callback) { activityLauncher = fragment.getActivity().getActivityResultRegistry().register(VENMO_SECURE_RESULT, fragment.getViewLifecycleOwner(), new VenmoActivityResultContract(), callback::onVenmoResult); } - public VenmoLauncher(FragmentActivity activity, VenmoResultCallback callback) { - activityLauncher = activity.getActivityResultRegistry().register(VENMO_SECURE_RESULT, activity, new VenmoActivityResultContract(), callback::onVenmoResult); - } - public void launch(VenmoIntentData venmoIntentData) { activityLauncher.launch(venmoIntentData); } From a540c02f35d50f412fd9f583c534bbcc71ebe24f Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Wed, 20 Sep 2023 17:01:45 -0500 Subject: [PATCH 05/14] Initial changes --- AmericanExpress/build.gradle | 48 +++------------------------ build.gradle | 21 ++++++++---- gradle.properties | 18 +++++++++- gradle/gradle-publish.gradle | 64 ++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 52 deletions(-) create mode 100644 gradle/gradle-publish.gradle diff --git a/AmericanExpress/build.gradle b/AmericanExpress/build.gradle index 2b04d7f0d9..ee51ca3690 100644 --- a/AmericanExpress/build.gradle +++ b/AmericanExpress/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -65,48 +63,10 @@ nexusPublishing { } } -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release +project.ext.name = "american-express" +project.ext.pom_name = "american-express" +project.ext.pom_desc = "American Express dependencies for Braintree Android." - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'american-express' - version = rootProject.versionName - - pom { - name = 'american-express' - packaging = 'aar' - description = 'American Express dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/build.gradle b/build.gradle index 87e390cddd..cf299913e7 100644 --- a/build.gradle +++ b/build.gradle @@ -82,8 +82,7 @@ buildscript { plugins { id 'org.jetbrains.dokka' version '1.7.10' - id 'io.codearte.nexus-staging' version '0.21.2' - id 'de.marcphilipp.nexus-publish' version '0.4.0' apply false + id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' } ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: '' @@ -106,12 +105,20 @@ ext { versionName = version } -nexusStaging { +nexusPublishing { packageGroup = project.hasProperty('nexusPackageGroup') ? project.getProperty('nexusPackageGroup') : 'com.braintreepayments' - // give nexus sonatype more time to close the staging repository - delayBetweenRetriesInMillis = 20000 - username = System.getenv('SONATYPE_USERNAME') - password = System.getenv('SONATYPE_PASSWORD') + + repositories { + sonatype { + username = System.getenv('SONATYPE_NEXUS_USERNAME') ?: '' + password = System.getenv('SONATYPE_NEXUS_PASSWORD') ?: '' + } + } + + transitionCheckOptions { + // give nexus sonatype more time to close the staging repository + delayBetween.set(Duration.ofSeconds(20)) + } } subprojects { diff --git a/gradle.properties b/gradle.properties index 42db5ad8c9..7fc8fa5323 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,20 @@ android.useAndroidX=true # Ref: https://stackoverflow.com/a/50673210 -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 \ No newline at end of file +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +POM_PACKAGING=aar + +POM_URL=https://github.com/braintree/braintree_android + +POM_SCM_URL=scm:git@github.com:braintree/braintree_android.git +POM_SCM_CONNECTION=scm:git@github.com:braintree/braintree_android.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:braintree/braintree_android.git + +POM_LICENSE_NAME=MIT +POM_LICENSE_URL=http://opensource.org/licenses/MIT +POM_LICENSE_DISTRIBUTION=repo + +POM_DEVELOPER_ID=devs +POM_DEVELOPER_NAME=Braintree Payments +POM_DEVELOPER_EMAIL=sdks@paypal.com \ No newline at end of file diff --git a/gradle/gradle-publish.gradle b/gradle/gradle-publish.gradle new file mode 100644 index 0000000000..0d3f05e052 --- /dev/null +++ b/gradle/gradle-publish.gradle @@ -0,0 +1,64 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + + +ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: '' +ext["signing.password"] = System.getenv('SIGNING_KEY_PASSWORD') ?: '' +ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_KEY_FILE') ?: '' + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + groupId group + version project.version + artifactId project.ext.name + from components.release + artifact sourcesJar + artifact javadocsJar + + pom { + name = project.ext.pom_name ?: '' + packaging = POM_PACKAGING + description = project.ext.pom_desc ?: '' + url = POM_URL + licenses { + license { + name = POM_LICENSE_NAME + url = POM_LICENSE_URL + distribution = POM_LICENSE_DISTRIBUTION + } + } + developers { + developer { + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME + email = POM_DEVELOPER_EMAIL + } + } + scm { + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION + url = POM_SCM_URL + } + } + } + } + } + + signing { + sign publishing.publications + sign configurations.archives + } +} + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs +} + +artifacts { + archives sourcesJar + archives javadocsJar +} \ No newline at end of file From 834fea061f39a93bffb26dc59c9939423a913fff Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Wed, 20 Sep 2023 17:19:22 -0500 Subject: [PATCH 06/14] Update more gradle files --- AmericanExpress/build.gradle | 16 -------- BraintreeCore/build.gradle | 64 ++--------------------------- BraintreeDataCollector/build.gradle | 64 ++--------------------------- Card/build.gradle | 64 ++--------------------------- GooglePay/build.gradle | 64 ++--------------------------- 5 files changed, 16 insertions(+), 256 deletions(-) diff --git a/AmericanExpress/build.gradle b/AmericanExpress/build.gradle index ee51ca3690..f2eda05768 100644 --- a/AmericanExpress/build.gradle +++ b/AmericanExpress/build.gradle @@ -47,22 +47,6 @@ task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - project.ext.name = "american-express" project.ext.pom_name = "american-express" project.ext.pom_desc = "American Express dependencies for Braintree Android." diff --git a/BraintreeCore/build.gradle b/BraintreeCore/build.gradle index 4f38f5592d..42f77bec1e 100644 --- a/BraintreeCore/build.gradle +++ b/BraintreeCore/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' id 'kotlin-kapt' } @@ -113,64 +111,10 @@ task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} +project.ext.name = "braintree-core" +project.ext.pom_name = "braintree-core" +project.ext.pom_desc = "This is Braintree\'s Android SDK. Integrate this library to accept payments in your Android app." -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'braintree-core' - version = rootProject.versionName - - pom { - name = 'braintree-core' - packaging = 'aar' - description = 'This is Braintree\'s Android SDK. Integrate this library to accept payments in your Android app.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/BraintreeDataCollector/build.gradle b/BraintreeDataCollector/build.gradle index 6c72828472..a9543e9781 100644 --- a/BraintreeDataCollector/build.gradle +++ b/BraintreeDataCollector/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -64,65 +62,11 @@ task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} +project.ext.name = "data-collector" +project.ext.pom_name = "data-collector" +project.ext.pom_desc = "Fraud tools for Braintree integrations on Android." -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'data-collector' - version = rootProject.versionName - - pom { - name = 'data-collector' - packaging = 'aar' - description = 'Fraud tools for Braintree integrations on Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/Card/build.gradle b/Card/build.gradle index 456cbdcd5a..e4a29572a9 100644 --- a/Card/build.gradle +++ b/Card/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -58,64 +56,10 @@ task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'card' - version = rootProject.versionName +project.ext.name = "card" +project.ext.pom_name = "card" +project.ext.pom_desc = "Card dependencies for Braintree Android." - pom { - name = 'card' - packaging = 'aar' - description = 'Card dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/GooglePay/build.gradle b/GooglePay/build.gradle index 910a7e8bd4..f01c64eecc 100644 --- a/GooglePay/build.gradle +++ b/GooglePay/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -65,64 +63,10 @@ task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs } -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "google-pay" +project.ext.pom_name = "google-pay" +project.ext.pom_desc = "Google Pay Module for Braintree\'s Android SDK." - groupId = 'com.braintreepayments.api' - artifactId = 'google-pay' - version = rootProject.versionName - - pom { - name = 'google-pay' - packaging = 'aar' - description = 'Google Pay Module for Braintree\'s Android SDK.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion From 801957d986041acd7f301e10ff65030372618d2e Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Wed, 20 Sep 2023 17:40:36 -0500 Subject: [PATCH 07/14] Update all gradle files --- AmericanExpress/build.gradle | 5 --- BraintreeCore/build.gradle | 5 --- BraintreeDataCollector/build.gradle | 5 --- Card/build.gradle | 5 --- GooglePay/build.gradle | 5 --- LocalPayment/build.gradle | 69 ++--------------------------- PayPal/build.gradle | 69 ++--------------------------- PayPalDataCollector/build.gradle | 69 ++--------------------------- PayPalNativeCheckout/build.gradle | 69 ++--------------------------- SEPADirectDebit/build.gradle | 69 ++--------------------------- SamsungPay/build.gradle | 69 ++--------------------------- SharedUtils/build.gradle | 69 ++--------------------------- ThreeDSecure/build.gradle | 69 ++--------------------------- UnionPay/build.gradle | 68 ++-------------------------- Venmo/build.gradle | 69 ++--------------------------- VisaCheckout/build.gradle | 69 ++--------------------------- gradle/gradle-publish.gradle | 5 +-- 17 files changed, 45 insertions(+), 743 deletions(-) diff --git a/AmericanExpress/build.gradle b/AmericanExpress/build.gradle index f2eda05768..83fdbd9036 100644 --- a/AmericanExpress/build.gradle +++ b/AmericanExpress/build.gradle @@ -42,11 +42,6 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - project.ext.name = "american-express" project.ext.pom_name = "american-express" project.ext.pom_desc = "American Express dependencies for Braintree Android." diff --git a/BraintreeCore/build.gradle b/BraintreeCore/build.gradle index 42f77bec1e..b916f70e48 100644 --- a/BraintreeCore/build.gradle +++ b/BraintreeCore/build.gradle @@ -106,11 +106,6 @@ gradle.taskGraph.whenReady { taskGraph -> // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - project.ext.name = "braintree-core" project.ext.pom_name = "braintree-core" project.ext.pom_desc = "This is Braintree\'s Android SDK. Integrate this library to accept payments in your Android app." diff --git a/BraintreeDataCollector/build.gradle b/BraintreeDataCollector/build.gradle index a9543e9781..5daa4ea5a4 100644 --- a/BraintreeDataCollector/build.gradle +++ b/BraintreeDataCollector/build.gradle @@ -57,11 +57,6 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - project.ext.name = "data-collector" project.ext.pom_name = "data-collector" project.ext.pom_desc = "Fraud tools for Braintree integrations on Android." diff --git a/Card/build.gradle b/Card/build.gradle index e4a29572a9..812d9b298a 100644 --- a/Card/build.gradle +++ b/Card/build.gradle @@ -51,11 +51,6 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - project.ext.name = "card" project.ext.pom_name = "card" project.ext.pom_desc = "Card dependencies for Braintree Android." diff --git a/GooglePay/build.gradle b/GooglePay/build.gradle index f01c64eecc..123f85c9d9 100644 --- a/GooglePay/build.gradle +++ b/GooglePay/build.gradle @@ -58,11 +58,6 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - project.ext.name = "google-pay" project.ext.pom_name = "google-pay" project.ext.pom_desc = "Google Pay Module for Braintree\'s Android SDK." diff --git a/LocalPayment/build.gradle b/LocalPayment/build.gradle index dc53965f99..598a7854e9 100644 --- a/LocalPayment/build.gradle +++ b/LocalPayment/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -50,69 +48,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "local-payment" +project.ext.pom_name = "local-payment" +project.ext.pom_desc = "Local Payment dependencies for Braintree Android." - groupId = 'com.braintreepayments.api' - artifactId = 'local-payment' - version = rootProject.versionName - - pom { - name = 'local-payment' - packaging = 'aar' - description = 'Local Payment dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/PayPal/build.gradle b/PayPal/build.gradle index 140dd0d32d..805825b466 100644 --- a/PayPal/build.gradle +++ b/PayPal/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -46,69 +44,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "paypal" +project.ext.pom_name = "paypal" +project.ext.pom_desc = "PayPal dependencies for Braintree Android." - groupId = 'com.braintreepayments.api' - artifactId = 'paypal' - version = rootProject.versionName - - pom { - name = 'paypal' - packaging = 'aar' - description = 'PayPal dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/PayPalDataCollector/build.gradle b/PayPalDataCollector/build.gradle index 01f097b8e6..ec75840aa8 100644 --- a/PayPalDataCollector/build.gradle +++ b/PayPalDataCollector/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -60,69 +58,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "paypal-data-collector" +project.ext.pom_name = "paypal-data-collector" +project.ext.pom_desc = "PayPal fraud tools for Braintree integrations on Android." - groupId = 'com.braintreepayments.api' - artifactId = 'paypal-data-collector' - version = rootProject.versionName - - pom { - name = 'paypal-data-collector' - packaging = 'aar' - description = 'PayPal fraud tools for Braintree integrations on Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/PayPalNativeCheckout/build.gradle b/PayPalNativeCheckout/build.gradle index 5d92ff03f0..096d9e942b 100644 --- a/PayPalNativeCheckout/build.gradle +++ b/PayPalNativeCheckout/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -51,69 +49,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "paypal-native-checkout" +project.ext.pom_name = "paypal-native-checkout" +project.ext.pom_desc = "PayPal Native Checkout dependencies for Braintree Android." - groupId = 'com.braintreepayments.api' - artifactId = 'paypal-native-checkout' - version = rootProject.versionName - - pom { - name = 'paypal-native-checkout' - packaging = 'aar' - description = 'PayPal Native Checkout dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/SEPADirectDebit/build.gradle b/SEPADirectDebit/build.gradle index c21a224b62..1cd8a5d573 100644 --- a/SEPADirectDebit/build.gradle +++ b/SEPADirectDebit/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -49,69 +47,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "sepa-direct-debit" +project.ext.pom_name = "sepa-direct-debit" +project.ext.pom_desc = "SEPA Direct Debit dependencies for Braintree Android." - groupId = 'com.braintreepayments.api' - artifactId = 'sepa-direct-debit' - version = rootProject.versionName - - pom { - name = 'sepa-direct-debit' - packaging = 'aar' - description = 'SEPA Direct Debit dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/SamsungPay/build.gradle b/SamsungPay/build.gradle index 0df3abfbb0..bad46fb35c 100644 --- a/SamsungPay/build.gradle +++ b/SamsungPay/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -52,69 +50,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release +project.ext.name = "samsung-pay" +project.ext.pom_name = "samsung-pay" +project.ext.pom_desc = "Samsung Pay Module for Braintree\'s Android SDK." - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'samsung-pay' - version = rootProject.versionName - - pom { - name = 'samsung-pay' - packaging = 'aar' - description = 'Samsung Pay Module for Braintree\'s Android SDK.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/SharedUtils/build.gradle b/SharedUtils/build.gradle index d664250a61..82b012f5a5 100644 --- a/SharedUtils/build.gradle +++ b/SharedUtils/build.gradle @@ -1,8 +1,6 @@ plugins { id 'com.android.library' id 'kotlin-android' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -51,69 +49,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release +project.ext.name = "shared-utils" +project.ext.pom_name = "shared-utils" +project.ext.pom_desc = "Library containing shared components used across Braintree\'s Android SDKs." - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'shared-utils' - version = rootProject.versionName - - pom { - name = 'shared-utils' - packaging = 'aar' - description = 'Library containing shared components used across Braintree\'s Android SDKs.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/ThreeDSecure/build.gradle b/ThreeDSecure/build.gradle index 63c21f358d..6ee016202f 100644 --- a/ThreeDSecure/build.gradle +++ b/ThreeDSecure/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -56,70 +54,11 @@ dependencies { // region signing and publishing - task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs - } +project.ext.name = "three-d-secure" +project.ext.pom_name = "three-d-secure" +project.ext.pom_desc = "3DS dependencies for Braintree Android." - signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications - } - - nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } - } - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'three-d-secure' - version = rootProject.versionName - - pom { - name = 'three-d-secure' - packaging = 'aar' - description = '3DS dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/UnionPay/build.gradle b/UnionPay/build.gradle index 5323985e0b..ee39eecf91 100644 --- a/UnionPay/build.gradle +++ b/UnionPay/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { compileSdkVersion rootProject.compileSdkVersion @@ -52,68 +50,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release +project.ext.name = "union-pay" +project.ext.pom_name = "union-pay" +project.ext.pom_desc = "Union Pay dependencies for Braintree Android." - artifact sourcesJar +apply from: rootProject.file("gradle/gradle-publish.gradle") - groupId = 'com.braintreepayments.api' - artifactId = 'union-pay' - version = rootProject.versionName - - pom { - name = 'union-pay' - packaging = 'aar' - description = 'Union Pay dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} // endregion diff --git a/Venmo/build.gradle b/Venmo/build.gradle index 1095c68b10..32d5514156 100644 --- a/Venmo/build.gradle +++ b/Venmo/build.gradle @@ -2,8 +2,6 @@ plugins { id 'com.android.library' id 'kotlin-android' id 'org.jetbrains.dokka' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -48,69 +46,10 @@ dependencies { // region signing and publishing -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - artifact sourcesJar +project.ext.name = "venmo" +project.ext.pom_name = "venmo" +project.ext.pom_desc = "Venmo dependencies for Braintree Android." - groupId = 'com.braintreepayments.api' - artifactId = 'venmo' - version = rootProject.versionName - - pom { - name = 'venmo' - packaging = 'aar' - description = 'Venmo dependencies for Braintree Android.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") // endregion diff --git a/VisaCheckout/build.gradle b/VisaCheckout/build.gradle index c86514bd78..b5959abe36 100644 --- a/VisaCheckout/build.gradle +++ b/VisaCheckout/build.gradle @@ -1,8 +1,6 @@ plugins { id 'com.android.library' id 'kotlin-android' - id 'de.marcphilipp.nexus-publish' - id 'signing' } android { @@ -53,67 +51,8 @@ dependencies { /* maven deploy + signing */ -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -signing { - required { - !version.endsWith("SNAPSHOT") && !version.endsWith("DEVELOPMENT") - } - sign publishing.publications -} - -nexusPublishing { - // give nexus sonatype more time to initialize the staging repository - clientTimeout = Duration.ofMinutes(3) - useStaging = !rootProject.versionName.endsWith("SNAPSHOT") - repositories { - sonatype() - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release +project.ext.name = "visa-checkout" +project.ext.pom_name = "visa-checkout" +project.ext.pom_desc = "Visa Checkout Module for Braintree\'s Android SDK." - artifact sourcesJar - - groupId = 'com.braintreepayments.api' - artifactId = 'visa-checkout' - version = rootProject.versionName - - pom { - name = 'visa-checkout' - packaging = 'aar' - description = 'Visa Checkout Module for Braintree\'s Android SDK.' - url = 'https://github.com/braintree/braintree_android' - - scm { - url = 'scm:git@github.com:braintree/braintree_android.git' - connection = 'scm:git@github.com:braintree/braintree_android.git' - developerConnection = 'scm:git@github.com:braintree/braintree_android.git' - } - - developers { - developer { - id = 'devs' - name = 'Braintree Payments' - } - } - - licenses { - license { - name = 'MIT' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - } - } - } - } -} +apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/gradle/gradle-publish.gradle b/gradle/gradle-publish.gradle index 0d3f05e052..739765725b 100644 --- a/gradle/gradle-publish.gradle +++ b/gradle/gradle-publish.gradle @@ -15,7 +15,6 @@ afterEvaluate { artifactId project.ext.name from components.release artifact sourcesJar - artifact javadocsJar pom { name = project.ext.pom_name ?: '' @@ -52,13 +51,11 @@ afterEvaluate { } } -task androidSourcesJar(type: Jar) { +task sourcesJar(type: Jar) { archiveClassifier.set('sources') from android.sourceSets.main.java.srcDirs - from android.sourceSets.main.kotlin.srcDirs } artifacts { archives sourcesJar - archives javadocsJar } \ No newline at end of file From bfda353fbeccc0a064a4d813e6a3f6eef3969194 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:26:00 -0500 Subject: [PATCH 08/14] Update for testing --- .../close_and_release_repository/action.yml | 6 +- .../actions/publish_all_modules/action.yml | 4 +- .github/workflows/release.yml | 244 +++++++++--------- AmericanExpress/build.gradle | 2 + BraintreeCore/build.gradle | 2 + BraintreeDataCollector/build.gradle | 2 + CHANGELOG.md | 4 + Card/build.gradle | 2 + GooglePay/build.gradle | 2 + LocalPayment/build.gradle | 2 + PayPal/build.gradle | 2 + PayPalDataCollector/build.gradle | 2 + PayPalNativeCheckout/build.gradle | 2 + SEPADirectDebit/build.gradle | 2 + SamsungPay/build.gradle | 2 + SharedUtils/build.gradle | 2 + ThreeDSecure/build.gradle | 2 + UnionPay/build.gradle | 2 + Venmo/build.gradle | 2 + VisaCheckout/build.gradle | 2 + build.gradle | 1 + gradle/gradle-publish.gradle | 24 +- 22 files changed, 183 insertions(+), 132 deletions(-) diff --git a/.github/actions/close_and_release_repository/action.yml b/.github/actions/close_and_release_repository/action.yml index 51688f78cd..c5cab7836f 100644 --- a/.github/actions/close_and_release_repository/action.yml +++ b/.github/actions/close_and_release_repository/action.yml @@ -24,11 +24,11 @@ inputs: runs: using: "composite" steps: - - run: ./gradlew --stacktrace closeAndReleaseRepository + - run: ./gradlew --stacktrace closeAndReleaseSonatypeStagingRepository shell: bash env: - SONATYPE_USERNAME: ${{ inputs.sonatype_usr }} - SONATYPE_PASSWORD: ${{ inputs.sonatype_pwd }} + SONATYPE_NEXUS_USERNAME: ${{ inputs.sonatype_usr }} + SONATYPE_NEXUS_PASSWORD: ${{ inputs.sonatype_pwd }} SIGNING_KEY_ID: ${{ inputs.signing_key_id }} SIGNING_KEY_PASSWORD: ${{ inputs.signing_key_pwd }} SIGNING_KEY_FILE: ${{ inputs.signing_key_file }} diff --git a/.github/actions/publish_all_modules/action.yml b/.github/actions/publish_all_modules/action.yml index 16b26763f8..95825428c7 100644 --- a/.github/actions/publish_all_modules/action.yml +++ b/.github/actions/publish_all_modules/action.yml @@ -43,8 +43,8 @@ runs: :PayPalNativeCheckout:publishToSonatype shell: bash env: - SONATYPE_USERNAME: ${{ inputs.sonatype_usr }} - SONATYPE_PASSWORD: ${{ inputs.sonatype_pwd }} + SONATYPE_NEXUS_USERNAME: ${{ inputs.sonatype_usr }} + SONATYPE_NEXUS_PASSWORD: ${{ inputs.sonatype_pwd }} SIGNING_KEY_ID: ${{ inputs.signing_key_id }} SIGNING_KEY_PASSWORD: ${{ inputs.signing_key_pwd }} SIGNING_KEY_FILE: ${{ inputs.signing_key_file }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4edd693f3b..1151c5c321 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,10 +38,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: AmericanExpress +m # - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: AmericanExpress unit_test_braintree_core: name: BraintreeCore Unit Tests runs-on: ubuntu-latest @@ -50,10 +50,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: BraintreeCore +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: BraintreeCore unit_test_paypal_data_collector: name: PayPalDataCollector Unit Tests runs-on: ubuntu-latest @@ -62,10 +62,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: PayPalDataCollector +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: PayPalDataCollector unit_test_braintree_data_collector: name: BraintreeDataCollector Unit Tests runs-on: ubuntu-latest @@ -74,10 +74,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: BraintreeDataCollector +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: BraintreeDataCollector unit_test_card: name: Card Unit Tests runs-on: ubuntu-latest @@ -86,10 +86,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: Card +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: Card unit_test_google_pay: name: GooglePay Unit Tests runs-on: ubuntu-latest @@ -98,10 +98,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: GooglePay +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: GooglePay unit_test_local_payment: name: LocalPayment Unit Tests runs-on: ubuntu-latest @@ -110,10 +110,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: LocalPayment +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: LocalPayment unit_test_paypal: name: PayPal Unit Tests runs-on: ubuntu-latest @@ -122,10 +122,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: PayPal +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: PayPal unit_test_samsung_pay: name: SamsungPay Unit Tests runs-on: ubuntu-latest @@ -134,10 +134,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: SamsungPay +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: SamsungPay unit_test_three_d_secure: name: ThreeDSecure Unit Tests runs-on: ubuntu-latest @@ -146,10 +146,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: ThreeDSecure +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: ThreeDSecure unit_test_union_pay: name: UnionPay Unit Tests runs-on: ubuntu-latest @@ -158,10 +158,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: UnionPay +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: UnionPay unit_test_venmo: name: Venmo Unit Tests runs-on: ubuntu-latest @@ -170,10 +170,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: Venmo +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: Venmo unit_test_visa_checkout: name: VisaCheckout Unit Tests runs-on: ubuntu-latest @@ -182,10 +182,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: VisaCheckout +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: VisaCheckout unit_test_sepa_direct_debit: name: SEPA Direct Debit Unit Tests runs-on: ubuntu-latest @@ -194,10 +194,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: SEPADirectDebit +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: SEPADirectDebit unit_test_paypal_native_checkout_debit: name: PayPal Native Checkout Unit Tests runs-on: ubuntu-latest @@ -206,10 +206,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup - - name: Run Unit Tests - uses: ./.github/actions/unit_test_module - with: - module: PayPalNativeCheckout +# - name: Run Unit Tests +# uses: ./.github/actions/unit_test_module +# with: +# module: PayPalNativeCheckout # Wait until all module unit tests are finished before continuing release process unit_test_finished: @@ -263,65 +263,65 @@ jobs: signing_key_id: ${{ secrets.SIGNING_KEY_ID }} signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} - - name: Close and Release Repository - uses: ./.github/actions/close_and_release_repository - with: - sonatype_usr: ${{ secrets.SONATYPE_NEXUS_USERNAME }} - sonatype_pwd: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - signing_key_id: ${{ secrets.SIGNING_KEY_ID }} - signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} - signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} - - releasing_finished: - needs: [ publish_all_modules ] - name: Releases Finished - runs-on: ubuntu-latest - steps: - - run: echo "Release finished" - - bump_version: - needs: [ releasing_finished ] - name: Bump Version - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Set GitHub User - uses: ./.github/actions/set_github_user - - name: Update Version - run: | - ./gradlew -PversionParam=${{ github.event.inputs.version }} changeGradleReleaseVersion - ./gradlew -PversionParam=${{ github.event.inputs.version }} changeREADMEVersion - ./gradlew -PversionParam=${{ github.event.inputs.version }} changeMigrationGuideVersion - ./gradlew -PversionParam=${{ github.event.inputs.version }} updateCHANGELOGVersion - ./gradlew dokkaHtmlMultiModule - git add -A - git commit -am 'Release ${{ github.event.inputs.version }}' - git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}' - - ./gradlew -PversionParam=${{ github.event.inputs.version }} incrementSNAPSHOTVersion - ./gradlew incrementVersionCode - git commit -am 'Prepare for development' - git push origin master ${{ github.event.inputs.version }} - - create_github_release: - needs: [ bump_version ] - name: Create GitHub Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Save changelog entries to a file - run: | - sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md - - name: Create GitHub release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.event.inputs.version }} - release_name: ${{ github.event.inputs.version }} - body_path: changelog_entries.md - draft: false - prerelease: false +# - name: Close and Release Repository +# uses: ./.github/actions/close_and_release_repository +# with: +# sonatype_usr: ${{ secrets.SONATYPE_NEXUS_USERNAME }} +# sonatype_pwd: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} +# signing_key_id: ${{ secrets.SIGNING_KEY_ID }} +# signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} +# signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} +# +# releasing_finished: +# needs: [ publish_all_modules ] +# name: Releases Finished +# runs-on: ubuntu-latest +# steps: +# - run: echo "Release finished" +# +# bump_version: +# needs: [ releasing_finished ] +# name: Bump Version +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Repository +# uses: actions/checkout@v2 +# - name: Set GitHub User +# uses: ./.github/actions/set_github_user +# - name: Update Version +# run: | +# ./gradlew -PversionParam=${{ github.event.inputs.version }} changeGradleReleaseVersion +# ./gradlew -PversionParam=${{ github.event.inputs.version }} changeREADMEVersion +# ./gradlew -PversionParam=${{ github.event.inputs.version }} changeMigrationGuideVersion +# ./gradlew -PversionParam=${{ github.event.inputs.version }} updateCHANGELOGVersion +# ./gradlew dokkaHtmlMultiModule +# git add -A +# git commit -am 'Release ${{ github.event.inputs.version }}' +# git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}' +# +# ./gradlew -PversionParam=${{ github.event.inputs.version }} incrementSNAPSHOTVersion +# ./gradlew incrementVersionCode +# git commit -am 'Prepare for development' +# git push origin master ${{ github.event.inputs.version }} +# +# create_github_release: +# needs: [ bump_version ] +# name: Create GitHub Release +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Repository +# uses: actions/checkout@v2 +# - name: Save changelog entries to a file +# run: | +# sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md +# - name: Create GitHub release +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ github.event.inputs.version }} +# release_name: ${{ github.event.inputs.version }} +# body_path: changelog_entries.md +# draft: false +# prerelease: false diff --git a/AmericanExpress/build.gradle b/AmericanExpress/build.gradle index 83fdbd9036..d56c5286e4 100644 --- a/AmericanExpress/build.gradle +++ b/AmericanExpress/build.gradle @@ -44,6 +44,8 @@ dependencies { project.ext.name = "american-express" project.ext.pom_name = "american-express" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "American Express dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/BraintreeCore/build.gradle b/BraintreeCore/build.gradle index b916f70e48..ee878d912d 100644 --- a/BraintreeCore/build.gradle +++ b/BraintreeCore/build.gradle @@ -108,6 +108,8 @@ gradle.taskGraph.whenReady { taskGraph -> project.ext.name = "braintree-core" project.ext.pom_name = "braintree-core" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "This is Braintree\'s Android SDK. Integrate this library to accept payments in your Android app." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/BraintreeDataCollector/build.gradle b/BraintreeDataCollector/build.gradle index 5daa4ea5a4..15317f8f8e 100644 --- a/BraintreeDataCollector/build.gradle +++ b/BraintreeDataCollector/build.gradle @@ -59,6 +59,8 @@ dependencies { project.ext.name = "data-collector" project.ext.pom_name = "data-collector" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Fraud tools for Braintree integrations on Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/CHANGELOG.md b/CHANGELOG.md index 224e518aa0..4c468bb990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Braintree Android SDK Release Notes +## unreleased + +* Upgrade publish plugin + ## 4.38.1 (2023-09-14) * ThreeDSecure diff --git a/Card/build.gradle b/Card/build.gradle index 812d9b298a..18d9e7668c 100644 --- a/Card/build.gradle +++ b/Card/build.gradle @@ -53,6 +53,8 @@ dependencies { project.ext.name = "card" project.ext.pom_name = "card" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Card dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/GooglePay/build.gradle b/GooglePay/build.gradle index 123f85c9d9..f19c7f97ba 100644 --- a/GooglePay/build.gradle +++ b/GooglePay/build.gradle @@ -60,6 +60,8 @@ dependencies { project.ext.name = "google-pay" project.ext.pom_name = "google-pay" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Google Pay Module for Braintree\'s Android SDK." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/LocalPayment/build.gradle b/LocalPayment/build.gradle index 598a7854e9..320b09acee 100644 --- a/LocalPayment/build.gradle +++ b/LocalPayment/build.gradle @@ -50,6 +50,8 @@ dependencies { project.ext.name = "local-payment" project.ext.pom_name = "local-payment" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Local Payment dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/PayPal/build.gradle b/PayPal/build.gradle index 805825b466..0e8688cf75 100644 --- a/PayPal/build.gradle +++ b/PayPal/build.gradle @@ -46,6 +46,8 @@ dependencies { project.ext.name = "paypal" project.ext.pom_name = "paypal" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "PayPal dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/PayPalDataCollector/build.gradle b/PayPalDataCollector/build.gradle index ec75840aa8..e1904090be 100644 --- a/PayPalDataCollector/build.gradle +++ b/PayPalDataCollector/build.gradle @@ -60,6 +60,8 @@ dependencies { project.ext.name = "paypal-data-collector" project.ext.pom_name = "paypal-data-collector" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "PayPal fraud tools for Braintree integrations on Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/PayPalNativeCheckout/build.gradle b/PayPalNativeCheckout/build.gradle index 096d9e942b..9db062a811 100644 --- a/PayPalNativeCheckout/build.gradle +++ b/PayPalNativeCheckout/build.gradle @@ -51,6 +51,8 @@ dependencies { project.ext.name = "paypal-native-checkout" project.ext.pom_name = "paypal-native-checkout" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "PayPal Native Checkout dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/SEPADirectDebit/build.gradle b/SEPADirectDebit/build.gradle index 1cd8a5d573..c46a567f8b 100644 --- a/SEPADirectDebit/build.gradle +++ b/SEPADirectDebit/build.gradle @@ -49,6 +49,8 @@ dependencies { project.ext.name = "sepa-direct-debit" project.ext.pom_name = "sepa-direct-debit" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "SEPA Direct Debit dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/SamsungPay/build.gradle b/SamsungPay/build.gradle index bad46fb35c..d461a274b5 100644 --- a/SamsungPay/build.gradle +++ b/SamsungPay/build.gradle @@ -52,6 +52,8 @@ dependencies { project.ext.name = "samsung-pay" project.ext.pom_name = "samsung-pay" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Samsung Pay Module for Braintree\'s Android SDK." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/SharedUtils/build.gradle b/SharedUtils/build.gradle index 82b012f5a5..712ed6468c 100644 --- a/SharedUtils/build.gradle +++ b/SharedUtils/build.gradle @@ -51,6 +51,8 @@ dependencies { project.ext.name = "shared-utils" project.ext.pom_name = "shared-utils" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Library containing shared components used across Braintree\'s Android SDKs." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/ThreeDSecure/build.gradle b/ThreeDSecure/build.gradle index 6ee016202f..6e7dc8d9d9 100644 --- a/ThreeDSecure/build.gradle +++ b/ThreeDSecure/build.gradle @@ -56,6 +56,8 @@ dependencies { project.ext.name = "three-d-secure" project.ext.pom_name = "three-d-secure" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "3DS dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/UnionPay/build.gradle b/UnionPay/build.gradle index ee39eecf91..8000cd9209 100644 --- a/UnionPay/build.gradle +++ b/UnionPay/build.gradle @@ -52,6 +52,8 @@ dependencies { project.ext.name = "union-pay" project.ext.pom_name = "union-pay" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Union Pay dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/Venmo/build.gradle b/Venmo/build.gradle index 32d5514156..a058c8d161 100644 --- a/Venmo/build.gradle +++ b/Venmo/build.gradle @@ -48,6 +48,8 @@ dependencies { project.ext.name = "venmo" project.ext.pom_name = "venmo" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Venmo dependencies for Braintree Android." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/VisaCheckout/build.gradle b/VisaCheckout/build.gradle index b5959abe36..bc930ae159 100644 --- a/VisaCheckout/build.gradle +++ b/VisaCheckout/build.gradle @@ -53,6 +53,8 @@ dependencies { project.ext.name = "visa-checkout" project.ext.pom_name = "visa-checkout" +project.ext.group_id = "com.braintreepayments.api" +project.ext.version = rootProject.version project.ext.pom_desc = "Visa Checkout Module for Braintree\'s Android SDK." apply from: rootProject.file("gradle/gradle-publish.gradle") diff --git a/build.gradle b/build.gradle index cf299913e7..2bfb0edd75 100644 --- a/build.gradle +++ b/build.gradle @@ -97,6 +97,7 @@ allprojects { } version '4.38.2-SNAPSHOT' +group 'com.braintreepayments' ext { compileSdkVersion = 34 minSdkVersion = 21 diff --git a/gradle/gradle-publish.gradle b/gradle/gradle-publish.gradle index 739765725b..d0730fbd79 100644 --- a/gradle/gradle-publish.gradle +++ b/gradle/gradle-publish.gradle @@ -10,11 +10,12 @@ afterEvaluate { publishing { publications { release(MavenPublication) { - groupId group - version project.version + groupId project.ext.group_id + version project.ext.version artifactId project.ext.name from components.release - artifact sourcesJar + artifact androidSourcesJar + artifact javadocsJar pom { name = project.ext.pom_name ?: '' @@ -51,11 +52,24 @@ afterEvaluate { } } -task sourcesJar(type: Jar) { +task javadocs(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + failOnError false +} + +task javadocsJar(type: Jar, dependsOn: javadocs) { + archiveClassifier.set('javadoc') + from javadocs.destinationDir +} + +task androidSourcesJar(type: Jar) { archiveClassifier.set('sources') from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs } artifacts { - archives sourcesJar + archives androidSourcesJar + archives javadocsJar } \ No newline at end of file From 025535f49930912e415eef697aa8ed33d0ff77d2 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:33:15 -0500 Subject: [PATCH 09/14] Revert unintented changes --- .../demo/PreferredPaymentMethodsFragment.java | 2 +- .../braintreepayments/demo/VenmoFragment.java | 19 ++---- .../braintreepayments/api/VenmoClient.java | 61 +++++-------------- .../api/VenmoIntenDataCallback.java | 6 -- .../api/VenmoIntentData.java | 2 +- .../braintreepayments/api/VenmoLauncher.java | 19 ------ .../braintreepayments/api/VenmoResult.java | 2 +- .../api/VenmoResultCallback.java | 6 -- 8 files changed, 23 insertions(+), 94 deletions(-) delete mode 100644 Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java delete mode 100644 Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java delete mode 100644 Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java diff --git a/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java b/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java index ff4ab9c57e..a22f42573d 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/PreferredPaymentMethodsFragment.java @@ -108,6 +108,6 @@ public void launchVenmo(View v) { if (requestError != null) { handleError(requestError); } - }, null); + }); } } diff --git a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java index 3edd9fa41c..4ed523549f 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java @@ -16,24 +16,16 @@ import com.braintreepayments.api.BraintreeClient; import com.braintreepayments.api.VenmoAccountNonce; import com.braintreepayments.api.VenmoClient; -import com.braintreepayments.api.VenmoIntenDataCallback; -import com.braintreepayments.api.VenmoIntentData; -import com.braintreepayments.api.VenmoLauncher; import com.braintreepayments.api.VenmoLineItem; import com.braintreepayments.api.VenmoListener; import com.braintreepayments.api.VenmoPaymentMethodUsage; import com.braintreepayments.api.VenmoRequest; -import com.braintreepayments.api.VenmoResult; -import com.braintreepayments.api.VenmoResultCallback; - import java.util.ArrayList; public class VenmoFragment extends BaseFragment implements VenmoListener { private ImageButton venmoButton; private VenmoClient venmoClient; - - private VenmoLauncher venmoLauncher; private BraintreeClient braintreeClient; @Nullable @@ -43,7 +35,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c venmoButton = view.findViewById(R.id.venmo_button); venmoButton.setOnClickListener(this::launchVenmo); - venmoLauncher = new VenmoLauncher(this, venmoResult -> venmoClient.onVenmoResult(venmoResult)); + braintreeClient = getBraintreeClient(); + venmoClient = new VenmoClient(this, braintreeClient); + venmoClient.setListener(this); return view; } @@ -63,9 +57,6 @@ public void launchVenmo(View v) { boolean shouldVault = Settings.vaultVenmo(activity) && !TextUtils.isEmpty(Settings.getCustomerId(activity)); - braintreeClient = getBraintreeClient(); - venmoClient = new VenmoClient(braintreeClient); - venmoClient.setListener(this); braintreeClient.getConfiguration((configuration, error) -> { if (venmoClient.isVenmoAppSwitchAvailable(activity)) { @@ -83,7 +74,7 @@ public void launchVenmo(View v) { lineItems.add(new VenmoLineItem(VenmoLineItem.KIND_DEBIT, "Two Items", 2, "10")); venmoRequest.setLineItems(lineItems); - venmoClient.tokenizeVenmoAccount(activity, venmoRequest, venmoIntentData -> venmoLauncher.launch(venmoIntentData)); + venmoClient.tokenizeVenmoAccount(activity, venmoRequest); } else if (configuration.isVenmoEnabled()) { showDialog("Please install the Venmo app first."); } else { @@ -101,4 +92,4 @@ public void onVenmoSuccess(@NonNull VenmoAccountNonce venmoAccountNonce) { public void onVenmoFailure(@NonNull Exception error) { handleError(error); } -} +} \ No newline at end of file diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index c95845e49c..98628f279c 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -85,9 +85,9 @@ public VenmoClient(@NonNull BraintreeClient braintreeClient) { this.sharedPrefsWriter = sharedPrefsWriter; this.deviceInspector = deviceInspector; this.venmoApi = venmoApi; -// if (activity != null && lifecycle != null) { -// addObserver(activity, lifecycle); -// } + if (activity != null && lifecycle != null) { + addObserver(activity, lifecycle); + } } private void addObserver(@NonNull FragmentActivity activity, @NonNull Lifecycle lifecycle) { @@ -129,31 +129,15 @@ public void showVenmoInGooglePlayStore(@NonNull FragmentActivity activity) { */ public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request) { tokenizeVenmoAccount(activity, request, new VenmoTokenizeAccountCallback() { - @Override - public void onResult(@Nullable Exception error) { - if (error != null) { - listener.onVenmoFailure(error); - } - } - }, - new VenmoIntenDataCallback() { - @Override - public void onVenmoIntentData(VenmoIntentData venmoIntentData) { - // todo - } - }); + @Override + public void onResult(@Nullable Exception error) { + if (error != null) { + listener.onVenmoFailure(error); + } + } + }); } - public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request, VenmoIntenDataCallback callback) { - tokenizeVenmoAccount(activity, request, new VenmoTokenizeAccountCallback() { - @Override - public void onResult(@Nullable Exception error) { - if (error != null) { - listener.onVenmoFailure(error); - } - } - }, callback); - } /** * Start the Pay With Venmo flow. This will app switch to the Venmo app. *

@@ -166,7 +150,7 @@ public void onResult(@Nullable Exception error) { * @param callback {@link VenmoTokenizeAccountCallback} */ @Deprecated - public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request, @NonNull final VenmoTokenizeAccountCallback callback, VenmoIntenDataCallback intentDataCallback) { + public void tokenizeVenmoAccount(@NonNull final FragmentActivity activity, @NonNull final VenmoRequest request, @NonNull final VenmoTokenizeAccountCallback callback) { braintreeClient.sendAnalyticsEvent("pay-with-venmo.selected"); braintreeClient.getConfiguration(new ConfigurationCallback() { @Override @@ -211,7 +195,7 @@ public void onResult(@Nullable final String paymentContextId, @Nullable Exceptio @Override public void onAuthorizationResult(@Nullable Authorization authorization, @Nullable Exception authError) { if (authorization != null) { - createVenmoIntentData(activity, request, configuration, authorization, finalVenmoProfileId, paymentContextId, intentDataCallback); + startVenmoActivityForResult(activity, request, configuration, authorization, finalVenmoProfileId, paymentContextId); } else { callback.onResult(authError); } @@ -247,24 +231,8 @@ private void startVenmoActivityForResult( } braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.started"); } - private void createVenmoIntentData( - final FragmentActivity activity, - final VenmoRequest request, - final Configuration configuration, - Authorization authorization, - final String venmoProfileId, - @Nullable final String paymentContextId, - VenmoIntenDataCallback callback - ) { - boolean isClientTokenAuth = (authorization instanceof ClientToken); - boolean shouldVault = request.getShouldVault() && isClientTokenAuth; - sharedPrefsWriter.persistVenmoVaultOption(activity, shouldVault); - VenmoIntentData intentData = new VenmoIntentData(configuration, venmoProfileId, paymentContextId, braintreeClient.getSessionId(), braintreeClient.getIntegrationType()); - callback.onVenmoIntentData(intentData); - braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.started"); - } - public void onVenmoResult(final VenmoResult venmoResult) { + void onVenmoResult(final VenmoResult venmoResult) { if (venmoResult.getError() == null) { braintreeClient.sendAnalyticsEvent("pay-with-venmo.app-switch.success"); @@ -277,6 +245,7 @@ public void onAuthorizationResult(@Nullable Authorization authorization, @Nullab String paymentContextId = venmoResult.getPaymentContextId(); if (paymentContextId != null) { venmoApi.createNonceFromPaymentContext(paymentContextId, new VenmoOnActivityResultCallback() { + @Override public void onResult(@Nullable VenmoAccountNonce nonce, @Nullable Exception error) { if (nonce != null) { boolean shouldVault = sharedPrefsWriter.getVenmoVaultOption(braintreeClient.getApplicationContext()); @@ -475,4 +444,4 @@ public void onResult(@Nullable Configuration configuration, @Nullable Exception } }); } -} +} \ No newline at end of file diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java deleted file mode 100644 index 23191ef4ae..0000000000 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntenDataCallback.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.braintreepayments.api; - -public interface VenmoIntenDataCallback { - - void onVenmoIntentData(VenmoIntentData venmoIntentData); -} diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java index 491aaa5eb1..ce20bdbd70 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoIntentData.java @@ -1,6 +1,6 @@ package com.braintreepayments.api; -public class VenmoIntentData { +class VenmoIntentData { private final Configuration configuration; private final String profileId; diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java deleted file mode 100644 index 8d8eea3166..0000000000 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.braintreepayments.api; - - -import androidx.activity.result.ActivityResultLauncher; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; - -public class VenmoLauncher { - ActivityResultLauncher activityLauncher; - private static final String VENMO_SECURE_RESULT = "com.braintreepayments.api.Venmo.RESULT"; - - public VenmoLauncher(Fragment fragment, VenmoResultCallback callback) { - activityLauncher = fragment.getActivity().getActivityResultRegistry().register(VENMO_SECURE_RESULT, fragment.getViewLifecycleOwner(), new VenmoActivityResultContract(), callback::onVenmoResult); - } - - public void launch(VenmoIntentData venmoIntentData) { - activityLauncher.launch(venmoIntentData); - } -} diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java index 370e226966..8d0e5f5f06 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoResult.java @@ -2,7 +2,7 @@ import androidx.annotation.Nullable; -public class VenmoResult { +class VenmoResult { private final Exception error; private final String paymentContextId; diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java deleted file mode 100644 index 43ba70f9f6..0000000000 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoResultCallback.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.braintreepayments.api; - -public interface VenmoResultCallback { - - void onVenmoResult(VenmoResult venmoResult); -} From 15397abcf6652ea661d6e48408234a9807aee04a Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:34:43 -0500 Subject: [PATCH 10/14] Fix spacing --- Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java | 2 +- gradle.properties | 2 +- gradle/gradle-publish.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index 98628f279c..387bacd081 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -444,4 +444,4 @@ public void onResult(@Nullable Configuration configuration, @Nullable Exception } }); } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 7fc8fa5323..6805086e5f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,4 @@ POM_LICENSE_DISTRIBUTION=repo POM_DEVELOPER_ID=devs POM_DEVELOPER_NAME=Braintree Payments -POM_DEVELOPER_EMAIL=sdks@paypal.com \ No newline at end of file +POM_DEVELOPER_EMAIL=sdks@paypal.com diff --git a/gradle/gradle-publish.gradle b/gradle/gradle-publish.gradle index d0730fbd79..63b577645e 100644 --- a/gradle/gradle-publish.gradle +++ b/gradle/gradle-publish.gradle @@ -72,4 +72,4 @@ task androidSourcesJar(type: Jar) { artifacts { archives androidSourcesJar archives javadocsJar -} \ No newline at end of file +} From 61eeef809e4b6570afaaea00983fa4c1f4dcdedf Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:36:04 -0500 Subject: [PATCH 11/14] Spacing changes --- .../src/main/java/com/braintreepayments/demo/VenmoFragment.java | 2 +- Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java index 4ed523549f..f2cf72a12f 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java +++ b/Demo/src/main/java/com/braintreepayments/demo/VenmoFragment.java @@ -92,4 +92,4 @@ public void onVenmoSuccess(@NonNull VenmoAccountNonce venmoAccountNonce) { public void onVenmoFailure(@NonNull Exception error) { handleError(error); } -} \ No newline at end of file +} diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index 387bacd081..422a0545cd 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -445,3 +445,4 @@ public void onResult(@Nullable Configuration configuration, @Nullable Exception }); } } + From 9e0b4c158306c1f72e02663dcea2762d016f7457 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:39:13 -0500 Subject: [PATCH 12/14] Spacing fix --- Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java index 422a0545cd..387bacd081 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoClient.java @@ -445,4 +445,3 @@ public void onResult(@Nullable Configuration configuration, @Nullable Exception }); } } - From 27db9c780ec67436a5688415d48a4d0ca8550abc Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:40:04 -0500 Subject: [PATCH 13/14] Fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1151c5c321..eb8ecb4b8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -m # - name: Run Unit Tests +# - name: Run Unit Tests # uses: ./.github/actions/unit_test_module # with: # module: AmericanExpress From 4ce2bb843c4c2a57d61479890645c314dba1e68c Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 21 Sep 2023 11:52:52 -0500 Subject: [PATCH 14/14] revert test changes --- .github/workflows/release.yml | 244 +++++++++++++++++----------------- CHANGELOG.md | 4 - 2 files changed, 122 insertions(+), 126 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb8ecb4b8d..4edd693f3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,10 +38,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: AmericanExpress + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: AmericanExpress unit_test_braintree_core: name: BraintreeCore Unit Tests runs-on: ubuntu-latest @@ -50,10 +50,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: BraintreeCore + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: BraintreeCore unit_test_paypal_data_collector: name: PayPalDataCollector Unit Tests runs-on: ubuntu-latest @@ -62,10 +62,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: PayPalDataCollector + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: PayPalDataCollector unit_test_braintree_data_collector: name: BraintreeDataCollector Unit Tests runs-on: ubuntu-latest @@ -74,10 +74,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: BraintreeDataCollector + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: BraintreeDataCollector unit_test_card: name: Card Unit Tests runs-on: ubuntu-latest @@ -86,10 +86,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: Card + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: Card unit_test_google_pay: name: GooglePay Unit Tests runs-on: ubuntu-latest @@ -98,10 +98,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: GooglePay + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: GooglePay unit_test_local_payment: name: LocalPayment Unit Tests runs-on: ubuntu-latest @@ -110,10 +110,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: LocalPayment + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: LocalPayment unit_test_paypal: name: PayPal Unit Tests runs-on: ubuntu-latest @@ -122,10 +122,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: PayPal + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: PayPal unit_test_samsung_pay: name: SamsungPay Unit Tests runs-on: ubuntu-latest @@ -134,10 +134,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: SamsungPay + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: SamsungPay unit_test_three_d_secure: name: ThreeDSecure Unit Tests runs-on: ubuntu-latest @@ -146,10 +146,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: ThreeDSecure + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: ThreeDSecure unit_test_union_pay: name: UnionPay Unit Tests runs-on: ubuntu-latest @@ -158,10 +158,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: UnionPay + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: UnionPay unit_test_venmo: name: Venmo Unit Tests runs-on: ubuntu-latest @@ -170,10 +170,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: Venmo + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: Venmo unit_test_visa_checkout: name: VisaCheckout Unit Tests runs-on: ubuntu-latest @@ -182,10 +182,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: VisaCheckout + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: VisaCheckout unit_test_sepa_direct_debit: name: SEPA Direct Debit Unit Tests runs-on: ubuntu-latest @@ -194,10 +194,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: SEPADirectDebit + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: SEPADirectDebit unit_test_paypal_native_checkout_debit: name: PayPal Native Checkout Unit Tests runs-on: ubuntu-latest @@ -206,10 +206,10 @@ jobs: uses: actions/checkout@v2 - name: Setup Java 8 uses: ./.github/actions/setup -# - name: Run Unit Tests -# uses: ./.github/actions/unit_test_module -# with: -# module: PayPalNativeCheckout + - name: Run Unit Tests + uses: ./.github/actions/unit_test_module + with: + module: PayPalNativeCheckout # Wait until all module unit tests are finished before continuing release process unit_test_finished: @@ -263,65 +263,65 @@ jobs: signing_key_id: ${{ secrets.SIGNING_KEY_ID }} signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} -# - name: Close and Release Repository -# uses: ./.github/actions/close_and_release_repository -# with: -# sonatype_usr: ${{ secrets.SONATYPE_NEXUS_USERNAME }} -# sonatype_pwd: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} -# signing_key_id: ${{ secrets.SIGNING_KEY_ID }} -# signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} -# signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} -# -# releasing_finished: -# needs: [ publish_all_modules ] -# name: Releases Finished -# runs-on: ubuntu-latest -# steps: -# - run: echo "Release finished" -# -# bump_version: -# needs: [ releasing_finished ] -# name: Bump Version -# runs-on: ubuntu-latest -# steps: -# - name: Checkout Repository -# uses: actions/checkout@v2 -# - name: Set GitHub User -# uses: ./.github/actions/set_github_user -# - name: Update Version -# run: | -# ./gradlew -PversionParam=${{ github.event.inputs.version }} changeGradleReleaseVersion -# ./gradlew -PversionParam=${{ github.event.inputs.version }} changeREADMEVersion -# ./gradlew -PversionParam=${{ github.event.inputs.version }} changeMigrationGuideVersion -# ./gradlew -PversionParam=${{ github.event.inputs.version }} updateCHANGELOGVersion -# ./gradlew dokkaHtmlMultiModule -# git add -A -# git commit -am 'Release ${{ github.event.inputs.version }}' -# git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}' -# -# ./gradlew -PversionParam=${{ github.event.inputs.version }} incrementSNAPSHOTVersion -# ./gradlew incrementVersionCode -# git commit -am 'Prepare for development' -# git push origin master ${{ github.event.inputs.version }} -# -# create_github_release: -# needs: [ bump_version ] -# name: Create GitHub Release -# runs-on: ubuntu-latest -# steps: -# - name: Checkout Repository -# uses: actions/checkout@v2 -# - name: Save changelog entries to a file -# run: | -# sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md -# - name: Create GitHub release -# id: create_release -# uses: actions/create-release@v1 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# tag_name: ${{ github.event.inputs.version }} -# release_name: ${{ github.event.inputs.version }} -# body_path: changelog_entries.md -# draft: false -# prerelease: false + - name: Close and Release Repository + uses: ./.github/actions/close_and_release_repository + with: + sonatype_usr: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + sonatype_pwd: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + signing_key_id: ${{ secrets.SIGNING_KEY_ID }} + signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} + signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} + + releasing_finished: + needs: [ publish_all_modules ] + name: Releases Finished + runs-on: ubuntu-latest + steps: + - run: echo "Release finished" + + bump_version: + needs: [ releasing_finished ] + name: Bump Version + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Set GitHub User + uses: ./.github/actions/set_github_user + - name: Update Version + run: | + ./gradlew -PversionParam=${{ github.event.inputs.version }} changeGradleReleaseVersion + ./gradlew -PversionParam=${{ github.event.inputs.version }} changeREADMEVersion + ./gradlew -PversionParam=${{ github.event.inputs.version }} changeMigrationGuideVersion + ./gradlew -PversionParam=${{ github.event.inputs.version }} updateCHANGELOGVersion + ./gradlew dokkaHtmlMultiModule + git add -A + git commit -am 'Release ${{ github.event.inputs.version }}' + git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}' + + ./gradlew -PversionParam=${{ github.event.inputs.version }} incrementSNAPSHOTVersion + ./gradlew incrementVersionCode + git commit -am 'Prepare for development' + git push origin master ${{ github.event.inputs.version }} + + create_github_release: + needs: [ bump_version ] + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Save changelog entries to a file + run: | + sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md + - name: Create GitHub release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.inputs.version }} + release_name: ${{ github.event.inputs.version }} + body_path: changelog_entries.md + draft: false + prerelease: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c468bb990..224e518aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,5 @@ # Braintree Android SDK Release Notes -## unreleased - -* Upgrade publish plugin - ## 4.38.1 (2023-09-14) * ThreeDSecure