Skip to content

Commit

Permalink
🔖 v12.4.0
Browse files Browse the repository at this point in the history
- Remove temporary workaround for Stripe Identity
- Update types for Payment Request Button
- Add support for PayPal Payments (requires beta access)
  • Loading branch information
richnologies committed Aug 10, 2021
1 parent 41eeb79 commit 3c8dbbc
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 12.4.0 - 2021-08-09

- Remove temporary workaround for Stripe Identity
- Update types for Payment Request Button
- Add support for PayPal Payments (requires beta access)

## 12.3.1 - 2021-06-30

- Add Stripe Verified Partner badge
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@angular/pwa": "^12.0.0",
"@angular/router": "^12.0.0",
"@angular/service-worker": "^12.0.0",
"@stripe/stripe-js": "^1.15.1",
"@stripe/stripe-js": "^1.16.0",
"core-js": "^2.5.4",
"ngx-build-modern": "^1.1.10",
"ngx-build-plus": "^12.0.1",
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-stripe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-stripe",
"version": "12.3.1",
"version": "12.4.0",
"repository": {
"type": "git",
"url": "https://github.com/richnologies/ngx-stripe"
Expand All @@ -14,6 +14,6 @@
"peerDependencies": {
"@angular/common": ">=9.0.0 <13.0.0",
"@angular/core": ">=9.0.0 <13.0.0",
"@stripe/stripe-js": "^1.15.0 <2.0.0"
"@stripe/stripe-js": "^1.16.0 <2.0.0"
}
}
28 changes: 18 additions & 10 deletions projects/ngx-stripe/src/lib/interfaces/stripe-instance.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,12 @@ import {
ConfirmIdealSetupData,
ConfirmSofortSetupData,
VerifyMicrodepositsForSetupData,
ConfirmAlipayPaymentOptions
ConfirmAlipayPaymentOptions,
VerificationSessionResult,
ConfirmPayPalPaymentData,
ConfirmPayPalSetupData
} from '@stripe/stripe-js';

// TEMPORARY WORKAROUND UNTIL OFFICIAL SUPPORT IS RELEASED
export interface VerificationSession {
id: string;
}

export type VerificationSessionResult =
| { verificationSession: VerificationSession; error?: undefined }
| { verificationSession?: undefined; error: StripeError };

export interface StripeServiceInterface {
getInstance(): Stripe | undefined;
elements(options?: StripeElementsOptions): Observable<StripeElements>;
Expand Down Expand Up @@ -197,6 +191,13 @@ export interface StripeServiceInterface {
paymentIntent?: PaymentIntent;
error?: StripeError;
}>;
confirmPayPalPayment(
clientSecret: string,
data?: ConfirmPayPalPaymentData
): Observable<{
paymentIntent?: PaymentIntent;
error?: StripeError;
}>;
confirmSepaDebitPayment(
clientSecret: string,
data?: ConfirmSepaDebitPaymentData
Expand Down Expand Up @@ -288,6 +289,13 @@ export interface StripeServiceInterface {
setupIntent?: SetupIntent;
error?: StripeError;
}>;
confirmPayPalSetup(
clientSecret: string,
data?: ConfirmPayPalSetupData
): Observable<{
setupIntent?: SetupIntent;
error?: StripeError;
}>;
confirmSepaDebitSetup(
clientSecret: string,
data?: ConfirmSepaDebitSetupData
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-stripe/src/lib/ngx-stripe.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const components = [

const directives = [StripeCardGroupDirective];

const currentVersion = '12.3.1';
const currentVersion = '12.4.0';

@NgModule({
declarations: [...components, ...directives],
Expand Down
39 changes: 36 additions & 3 deletions projects/ngx-stripe/src/lib/services/stripe-instance.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ import {
ConfirmIdealSetupData,
ConfirmSofortSetupData,
VerifyMicrodepositsForSetupData,
WrapperLibrary
WrapperLibrary,
VerificationSessionResult,
ConfirmPayPalPaymentData,
ConfirmPayPalSetupData
} from '@stripe/stripe-js';

import { StripeServiceInterface, VerificationSessionResult } from '../interfaces/stripe-instance.interface';
import { StripeServiceInterface } from '../interfaces/stripe-instance.interface';

import { WindowRef } from './window-ref.service';
import {
Expand Down Expand Up @@ -356,6 +359,21 @@ export class StripeInstance implements StripeServiceInterface {
);
}

confirmPayPalPayment(
clientSecret: string,
data?: ConfirmPayPalPaymentData
): Observable<{
paymentIntent?: PaymentIntent;
error?: StripeError;
}> {
return this.stripe.pipe(
switchMap((stripe) =>
from(stripe.confirmPayPalPayment(clientSecret, data))
),
first()
);
}

confirmSepaDebitPayment(
clientSecret: string,
data?: ConfirmSepaDebitPaymentData
Expand Down Expand Up @@ -547,6 +565,21 @@ export class StripeInstance implements StripeServiceInterface {
);
}

confirmPayPalSetup(
clientSecret: string,
data?: ConfirmPayPalSetupData
): Observable<{
setupIntent?: SetupIntent;
error?: StripeError;
}> {
return this.stripe.pipe(
switchMap((stripe) =>
from(stripe.confirmPayPalSetup(clientSecret, data))
),
first()
);
}

confirmSepaDebitSetup(
clientSecret: string,
data?: ConfirmSepaDebitSetupData
Expand Down Expand Up @@ -670,7 +703,7 @@ export class StripeInstance implements StripeServiceInterface {

verifyIdentity(clientSecret: string): Observable<VerificationSessionResult> {
return this.stripe.pipe(
switchMap((stripe) => from((stripe as any).verifyIdentity(clientSecret) as Promise<VerificationSessionResult>)),
switchMap((stripe) => from(stripe.verifyIdentity(clientSecret))),
first()
);
}
Expand Down
25 changes: 24 additions & 1 deletion projects/ngx-stripe/src/lib/services/stripe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ import {
ConfirmIdealSetupData,
ConfirmSofortSetupData,
VerifyMicrodepositsForSetupData,
VerificationSessionResult,
ConfirmPayPalPaymentData,
ConfirmPayPalSetupData,
} from '@stripe/stripe-js';

import {
STRIPE_PUBLISHABLE_KEY,
STRIPE_OPTIONS,
NGX_STRIPE_VERSION
} from '../interfaces/ngx-stripe.interface';
import { StripeServiceInterface, VerificationSessionResult } from '../interfaces/stripe-instance.interface';
import { StripeServiceInterface } from '../interfaces/stripe-instance.interface';

import { WindowRef } from './window-ref.service';
import {
Expand Down Expand Up @@ -289,6 +292,16 @@ export class StripeService implements StripeServiceInterface {
return this.stripe.confirmP24Payment(clientSecret, data, options);
}

confirmPayPalPayment(
clientSecret: string,
data?: ConfirmPayPalPaymentData
): Observable<{
paymentIntent?: PaymentIntent;
error?: StripeError;
}> {
return this.stripe.confirmPayPalPayment(clientSecret, data);
}

confirmSepaDebitPayment(
clientSecret: string,
data?: ConfirmSepaDebitPaymentData
Expand Down Expand Up @@ -419,6 +432,16 @@ export class StripeService implements StripeServiceInterface {
return this.stripe.confirmIdealSetup(clientSecret, data);
}

confirmPayPalSetup(
clientSecret: string,
data?: ConfirmPayPalSetupData
): Observable<{
setupIntent?: SetupIntent;
error?: StripeError;
}> {
return this.stripe.confirmPayPalSetup(clientSecret, data);
}

confirmSepaDebitSetup(
clientSecret: string,
data?: ConfirmSepaDebitSetupData
Expand Down

0 comments on commit 3c8dbbc

Please sign in to comment.