Skip to content

Commit

Permalink
feat(stripe): remove identity method(moved to @capacitor-community/st…
Browse files Browse the repository at this point in the history
…ripe-identity)
  • Loading branch information
rdlabo committed Oct 7, 2023
1 parent 822cade commit 8efc806
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 435 deletions.
135 changes: 0 additions & 135 deletions packages/payment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ Learn at [the official @capacitor-community/stripe documentation](https://stripe
* [`addListener(GooglePayEventsEnum.Completed, ...)`](#addlistenergooglepayeventsenumcompleted)
* [`addListener(GooglePayEventsEnum.Canceled, ...)`](#addlistenergooglepayeventsenumcanceled)
* [`addListener(GooglePayEventsEnum.Failed, ...)`](#addlistenergooglepayeventsenumfailed)
* [`createIdentityVerificationSheet(...)`](#createidentityverificationsheet)
* [`presentIdentityVerificationSheet()`](#presentidentityverificationsheet)
* [`addListener(IdentityVerificationSheetEventsEnum.Loaded, ...)`](#addlisteneridentityverificationsheeteventsenumloaded)
* [`addListener(IdentityVerificationSheetEventsEnum.FailedToLoad, ...)`](#addlisteneridentityverificationsheeteventsenumfailedtoload)
* [`addListener(IdentityVerificationSheetEventsEnum.Completed, ...)`](#addlisteneridentityverificationsheeteventsenumcompleted)
* [`addListener(IdentityVerificationSheetEventsEnum.Canceled, ...)`](#addlisteneridentityverificationsheeteventsenumcanceled)
* [`addListener(IdentityVerificationSheetEventsEnum.Failed, ...)`](#addlisteneridentityverificationsheeteventsenumfailed)
* [`createPaymentFlow(...)`](#createpaymentflow)
* [`presentPaymentFlow()`](#presentpaymentflow)
* [`confirmPaymentFlow()`](#confirmpaymentflow)
Expand Down Expand Up @@ -333,110 +326,6 @@ addListener(eventName: GooglePayEventsEnum.Failed, listenerFunc: () => void) =>
--------------------


### createIdentityVerificationSheet(...)

```typescript
createIdentityVerificationSheet(options: CreateIdentityVerificationSheetOption) => Promise<void>
```

| Param | Type |
| ------------- | ------------------------------------------------------------------------------------------------------- |
| **`options`** | <code><a href="#createidentityverificationsheetoption">CreateIdentityVerificationSheetOption</a></code> |

--------------------


### presentIdentityVerificationSheet()

```typescript
presentIdentityVerificationSheet() => Promise<{ identityVerificationResult: IdentityVerificationSheetResultInterface; }>
```

**Returns:** <code>Promise&lt;{ identityVerificationResult: <a href="#identityverificationsheetresultinterface">IdentityVerificationSheetResultInterface</a>; }&gt;</code>

--------------------


### addListener(IdentityVerificationSheetEventsEnum.Loaded, ...)

```typescript
addListener(eventName: IdentityVerificationSheetEventsEnum.Loaded, listenerFunc: () => void) => PluginListenerHandle
```

| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| **`eventName`** | <code><a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Loaded</a></code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

--------------------


### addListener(IdentityVerificationSheetEventsEnum.FailedToLoad, ...)

```typescript
addListener(eventName: IdentityVerificationSheetEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => PluginListenerHandle
```

| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| **`eventName`** | <code><a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.FailedToLoad</a></code> |
| **`listenerFunc`** | <code>(error: string) =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

--------------------


### addListener(IdentityVerificationSheetEventsEnum.Completed, ...)

```typescript
addListener(eventName: IdentityVerificationSheetEventsEnum.Completed, listenerFunc: () => void) => PluginListenerHandle
```

| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------------------- |
| **`eventName`** | <code><a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Completed</a></code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

--------------------


### addListener(IdentityVerificationSheetEventsEnum.Canceled, ...)

```typescript
addListener(eventName: IdentityVerificationSheetEventsEnum.Canceled, listenerFunc: () => void) => PluginListenerHandle
```

| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------------------ |
| **`eventName`** | <code><a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Canceled</a></code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

--------------------


### addListener(IdentityVerificationSheetEventsEnum.Failed, ...)

```typescript
addListener(eventName: IdentityVerificationSheetEventsEnum.Failed, listenerFunc: (error: string) => void) => PluginListenerHandle
```

| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| **`eventName`** | <code><a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Failed</a></code> |
| **`listenerFunc`** | <code>(error: string) =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

--------------------


### createPaymentFlow(...)

```typescript
Expand Down Expand Up @@ -778,14 +667,6 @@ iOS Only
| **`currency`** | <code>string</code> | Web only need stripe-pwa-elements &gt; 1.1.0 |


#### CreateIdentityVerificationSheetOption

| Prop | Type |
| ------------------------ | ------------------- |
| **`verificationId`** | <code>string</code> |
| **`ephemeralKeySecret`** | <code>string</code> |


#### CreatePaymentFlowOption

| Prop | Type | Description | Default |
Expand Down Expand Up @@ -869,11 +750,6 @@ iOS Only
<code><a href="#googlepayeventsenum">GooglePayEventsEnum.Completed</a> | <a href="#googlepayeventsenum">GooglePayEventsEnum.Canceled</a> | <a href="#googlepayeventsenum">GooglePayEventsEnum.Failed</a></code>


#### IdentityVerificationSheetResultInterface

<code><a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Completed</a> | <a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Canceled</a> | <a href="#identityverificationsheeteventsenum">IdentityVerificationSheetEventsEnum.Failed</a></code>


#### PaymentFlowResultInterface

<code><a href="#paymentfloweventsenum">PaymentFlowEventsEnum.Completed</a> | <a href="#paymentfloweventsenum">PaymentFlowEventsEnum.Canceled</a> | <a href="#paymentfloweventsenum">PaymentFlowEventsEnum.Failed</a></code>
Expand Down Expand Up @@ -911,17 +787,6 @@ iOS Only
| **`Failed`** | <code>"googlePayFailed"</code> |


#### IdentityVerificationSheetEventsEnum

| Members | Value |
| ------------------ | ---------------------------------------------------- |
| **`Loaded`** | <code>"identityVerificationSheetLoaded"</code> |
| **`FailedToLoad`** | <code>"identityVerificationSheetFailedToLoad"</code> |
| **`Completed`** | <code>"identityVerificationSheetCompleted"</code> |
| **`Canceled`** | <code>"identityVerificationSheetCanceled"</code> |
| **`Failed`** | <code>"identityVerificationSheetFailed"</code> |


#### PaymentFlowEventsEnum

| Members | Value |
Expand Down
10 changes: 2 additions & 8 deletions packages/payment/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,8 @@ dependencies {
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"

implementation 'com.stripe:stripe-android:20.32.+'
implementation('com.stripe:stripecardscan:20.32.+') {
exclude module: 'stripecardscan-tflite'
exclude module: 'ml-core-cardscan'
}

implementation 'com.stripe:identity:20.32.+'
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.android.gms:play-services-wallet:19.2.+'
implementation 'com.google.code.gson:gson:2.10.+'

implementation "androidx.core:core-ktx:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import com.getcapacitor.PluginMethod;
import com.getcapacitor.community.stripe.googlepay.GooglePayExecutor;
import com.getcapacitor.community.stripe.helper.MetaData;
import com.getcapacitor.community.stripe.identityverification.IdentityVerificationSheetExecutor;
import com.getcapacitor.community.stripe.paymentflow.PaymentFlowExecutor;
import com.getcapacitor.community.stripe.paymentsheet.PaymentSheetExecutor;
import com.stripe.android.PaymentConfiguration;
import com.stripe.android.Stripe;
import com.stripe.android.core.AppInfo;
import com.stripe.android.googlepaylauncher.GooglePayLauncher;
import com.stripe.android.identity.IdentityVerificationSheet;
import com.stripe.android.paymentsheet.PaymentSheet;

import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -60,13 +58,6 @@ public class StripePlugin extends Plugin {
getLogTag()
);

private final IdentityVerificationSheetExecutor identityVerificationSheetExecutor = new IdentityVerificationSheetExecutor(
this::getContext,
this::getActivity,
this::notifyListeners,
getLogTag()
);

@Override
public void load() {
metaData = new MetaData(this::getContext);
Expand Down Expand Up @@ -108,16 +99,16 @@ public void load() {
}
);

// this.paymentFlowExecutor.flowController =
// PaymentSheet.FlowController.create(
// getActivity(),
// paymentOption -> {
// this.paymentFlowExecutor.onPaymentOption(bridge, paymentFlowCallbackId, paymentOption);
// },
// result -> {
// this.paymentFlowExecutor.onPaymentFlowResult(bridge, paymentFlowCallbackId, result);
// }
// );
this.paymentFlowExecutor.flowController =
PaymentSheet.FlowController.create(
getActivity(),
paymentOption -> {
this.paymentFlowExecutor.onPaymentOption(bridge, paymentFlowCallbackId, paymentOption);
},
result -> {
this.paymentFlowExecutor.onPaymentFlowResult(bridge, paymentFlowCallbackId, result);
}
);

if (metaData.enableIdentifier) {
Resources resources = getActivity().getApplicationContext().getResources();
Expand All @@ -128,28 +119,6 @@ public void load() {
.appendPath(resources.getResourceTypeName(resourceId))
.appendPath(resources.getResourceEntryName(resourceId))
.build();

this.identityVerificationSheetExecutor.verificationSheet =
IdentityVerificationSheet.Companion.create(
getActivity(),
new IdentityVerificationSheet.Configuration(icon),
verificationFlowResult -> {
// handle verificationResult
if (verificationFlowResult instanceof IdentityVerificationSheet.VerificationFlowResult.Completed) {
// The user has completed uploading their documents.
// Let them know that the verification is processing.
this.identityVerificationSheetExecutor.onVerificationCompleted(bridge, identityVerificationCallbackId);
} else if (verificationFlowResult instanceof IdentityVerificationSheet.VerificationFlowResult.Canceled) {
// The user did not complete uploading their documents.
// You should allow them to try again.
this.identityVerificationSheetExecutor.onVerificationCancelled(bridge, identityVerificationCallbackId);
} else if (verificationFlowResult instanceof IdentityVerificationSheet.VerificationFlowResult.Failed) {
// If the flow fails, you should display the localized error
// message to your user using throwable.getLocalizedMessage()
this.identityVerificationSheetExecutor.onVerificationFailed(bridge, identityVerificationCallbackId);
}
}
);
}
}

Expand Down Expand Up @@ -178,19 +147,6 @@ public void createPaymentSheet(final PluginCall call) {
paymentSheetExecutor.createPaymentSheet(call);
}

@PluginMethod
public void createIdentityVerificationSheet(final PluginCall call) {
identityVerificationSheetExecutor.createIdentityVerificationSheet(call);
}

@PluginMethod
public void presentIdentityVerificationSheet(final PluginCall call) {
identityVerificationCallbackId = call.getCallbackId();
bridge.saveCall(call);

identityVerificationSheetExecutor.presentIdentityVerificationSheet(call);
}

@PluginMethod
public void presentPaymentSheet(final PluginCall call) {
paymentSheetCallbackId = call.getCallbackId();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8efc806

Please sign in to comment.