Skip to content

Commit 3c8dbbc

Browse files
committed
🔖 v12.4.0
- Remove temporary workaround for Stripe Identity - Update types for Payment Request Button - Add support for PayPal Payments (requires beta access)
1 parent 41eeb79 commit 3c8dbbc

File tree

7 files changed

+88
-18
lines changed

7 files changed

+88
-18
lines changed

‎CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 12.4.0 - 2021-08-09
4+
5+
- Remove temporary workaround for Stripe Identity
6+
- Update types for Payment Request Button
7+
- Add support for PayPal Payments (requires beta access)
8+
39
## 12.3.1 - 2021-06-30
410

511
- Add Stripe Verified Partner badge

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@angular/pwa": "^12.0.0",
4343
"@angular/router": "^12.0.0",
4444
"@angular/service-worker": "^12.0.0",
45-
"@stripe/stripe-js": "^1.15.1",
45+
"@stripe/stripe-js": "^1.16.0",
4646
"core-js": "^2.5.4",
4747
"ngx-build-modern": "^1.1.10",
4848
"ngx-build-plus": "^12.0.1",

‎projects/ngx-stripe/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-stripe",
3-
"version": "12.3.1",
3+
"version": "12.4.0",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/richnologies/ngx-stripe"
@@ -14,6 +14,6 @@
1414
"peerDependencies": {
1515
"@angular/common": ">=9.0.0 <13.0.0",
1616
"@angular/core": ">=9.0.0 <13.0.0",
17-
"@stripe/stripe-js": "^1.15.0 <2.0.0"
17+
"@stripe/stripe-js": "^1.16.0 <2.0.0"
1818
}
1919
}

‎projects/ngx-stripe/src/lib/interfaces/stripe-instance.interface.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,12 @@ import {
6868
ConfirmIdealSetupData,
6969
ConfirmSofortSetupData,
7070
VerifyMicrodepositsForSetupData,
71-
ConfirmAlipayPaymentOptions
71+
ConfirmAlipayPaymentOptions,
72+
VerificationSessionResult,
73+
ConfirmPayPalPaymentData,
74+
ConfirmPayPalSetupData
7275
} from '@stripe/stripe-js';
7376

74-
// TEMPORARY WORKAROUND UNTIL OFFICIAL SUPPORT IS RELEASED
75-
export interface VerificationSession {
76-
id: string;
77-
}
78-
79-
export type VerificationSessionResult =
80-
| { verificationSession: VerificationSession; error?: undefined }
81-
| { verificationSession?: undefined; error: StripeError };
82-
8377
export interface StripeServiceInterface {
8478
getInstance(): Stripe | undefined;
8579
elements(options?: StripeElementsOptions): Observable<StripeElements>;
@@ -197,6 +191,13 @@ export interface StripeServiceInterface {
197191
paymentIntent?: PaymentIntent;
198192
error?: StripeError;
199193
}>;
194+
confirmPayPalPayment(
195+
clientSecret: string,
196+
data?: ConfirmPayPalPaymentData
197+
): Observable<{
198+
paymentIntent?: PaymentIntent;
199+
error?: StripeError;
200+
}>;
200201
confirmSepaDebitPayment(
201202
clientSecret: string,
202203
data?: ConfirmSepaDebitPaymentData
@@ -288,6 +289,13 @@ export interface StripeServiceInterface {
288289
setupIntent?: SetupIntent;
289290
error?: StripeError;
290291
}>;
292+
confirmPayPalSetup(
293+
clientSecret: string,
294+
data?: ConfirmPayPalSetupData
295+
): Observable<{
296+
setupIntent?: SetupIntent;
297+
error?: StripeError;
298+
}>;
291299
confirmSepaDebitSetup(
292300
clientSecret: string,
293301
data?: ConfirmSepaDebitSetupData

‎projects/ngx-stripe/src/lib/ngx-stripe.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const components = [
4141

4242
const directives = [StripeCardGroupDirective];
4343

44-
const currentVersion = '12.3.1';
44+
const currentVersion = '12.4.0';
4545

4646
@NgModule({
4747
declarations: [...components, ...directives],

‎projects/ngx-stripe/src/lib/services/stripe-instance.class.ts

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ import {
7171
ConfirmIdealSetupData,
7272
ConfirmSofortSetupData,
7373
VerifyMicrodepositsForSetupData,
74-
WrapperLibrary
74+
WrapperLibrary,
75+
VerificationSessionResult,
76+
ConfirmPayPalPaymentData,
77+
ConfirmPayPalSetupData
7578
} from '@stripe/stripe-js';
7679

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

7982
import { WindowRef } from './window-ref.service';
8083
import {
@@ -356,6 +359,21 @@ export class StripeInstance implements StripeServiceInterface {
356359
);
357360
}
358361

362+
confirmPayPalPayment(
363+
clientSecret: string,
364+
data?: ConfirmPayPalPaymentData
365+
): Observable<{
366+
paymentIntent?: PaymentIntent;
367+
error?: StripeError;
368+
}> {
369+
return this.stripe.pipe(
370+
switchMap((stripe) =>
371+
from(stripe.confirmPayPalPayment(clientSecret, data))
372+
),
373+
first()
374+
);
375+
}
376+
359377
confirmSepaDebitPayment(
360378
clientSecret: string,
361379
data?: ConfirmSepaDebitPaymentData
@@ -547,6 +565,21 @@ export class StripeInstance implements StripeServiceInterface {
547565
);
548566
}
549567

568+
confirmPayPalSetup(
569+
clientSecret: string,
570+
data?: ConfirmPayPalSetupData
571+
): Observable<{
572+
setupIntent?: SetupIntent;
573+
error?: StripeError;
574+
}> {
575+
return this.stripe.pipe(
576+
switchMap((stripe) =>
577+
from(stripe.confirmPayPalSetup(clientSecret, data))
578+
),
579+
first()
580+
);
581+
}
582+
550583
confirmSepaDebitSetup(
551584
clientSecret: string,
552585
data?: ConfirmSepaDebitSetupData
@@ -670,7 +703,7 @@ export class StripeInstance implements StripeServiceInterface {
670703

671704
verifyIdentity(clientSecret: string): Observable<VerificationSessionResult> {
672705
return this.stripe.pipe(
673-
switchMap((stripe) => from((stripe as any).verifyIdentity(clientSecret) as Promise<VerificationSessionResult>)),
706+
switchMap((stripe) => from(stripe.verifyIdentity(clientSecret))),
674707
first()
675708
);
676709
}

‎projects/ngx-stripe/src/lib/services/stripe.service.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ import {
7272
ConfirmIdealSetupData,
7373
ConfirmSofortSetupData,
7474
VerifyMicrodepositsForSetupData,
75+
VerificationSessionResult,
76+
ConfirmPayPalPaymentData,
77+
ConfirmPayPalSetupData,
7578
} from '@stripe/stripe-js';
7679

7780
import {
7881
STRIPE_PUBLISHABLE_KEY,
7982
STRIPE_OPTIONS,
8083
NGX_STRIPE_VERSION
8184
} from '../interfaces/ngx-stripe.interface';
82-
import { StripeServiceInterface, VerificationSessionResult } from '../interfaces/stripe-instance.interface';
85+
import { StripeServiceInterface } from '../interfaces/stripe-instance.interface';
8386

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

295+
confirmPayPalPayment(
296+
clientSecret: string,
297+
data?: ConfirmPayPalPaymentData
298+
): Observable<{
299+
paymentIntent?: PaymentIntent;
300+
error?: StripeError;
301+
}> {
302+
return this.stripe.confirmPayPalPayment(clientSecret, data);
303+
}
304+
292305
confirmSepaDebitPayment(
293306
clientSecret: string,
294307
data?: ConfirmSepaDebitPaymentData
@@ -419,6 +432,16 @@ export class StripeService implements StripeServiceInterface {
419432
return this.stripe.confirmIdealSetup(clientSecret, data);
420433
}
421434

435+
confirmPayPalSetup(
436+
clientSecret: string,
437+
data?: ConfirmPayPalSetupData
438+
): Observable<{
439+
setupIntent?: SetupIntent;
440+
error?: StripeError;
441+
}> {
442+
return this.stripe.confirmPayPalSetup(clientSecret, data);
443+
}
444+
422445
confirmSepaDebitSetup(
423446
clientSecret: string,
424447
data?: ConfirmSepaDebitSetupData

0 commit comments

Comments
 (0)