Skip to content

Commit 388e235

Browse files
committed
Test for present client secret on Stripe SCA payment
1 parent bfd1e20 commit 388e235

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

api/payments_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ func TestPaymentCreate(t *testing.T) {
429429
t.Run("PaymentIntent", func(t *testing.T) {
430430
stripeCardSimple := "payment-method-simple"
431431
stripeCardSCA := "payment-method-sca"
432+
stripeClientSecret := "payment-intent-secret"
432433

433434
tests := map[string]string{
434435
"AutomaticConfirm": stripeCardSimple,
@@ -462,6 +463,7 @@ func TestPaymentCreate(t *testing.T) {
462463
intent.Status = stripe.PaymentIntentStatusSucceeded
463464
case stripeCardSCA:
464465
intent.Status = stripe.PaymentIntentStatusRequiresAction
466+
intent.ClientSecret = stripeClientSecret
465467
default:
466468
t.Errorf("unknown payment method: %s", pm)
467469
}
@@ -505,6 +507,9 @@ func TestPaymentCreate(t *testing.T) {
505507
}
506508
assert.Equal(t, expectedStatus, trans.Status)
507509
assert.Equal(t, stripePaymentIntentID, trans.ProcessorID)
510+
if expectedStatus == models.PendingState {
511+
assert.Equal(t, trans.ProviderMetadata["payment_intent_secret"], stripeClientSecret)
512+
}
508513
assert.Equal(t, 1, callCount)
509514

510515
order := &models.Order{}

0 commit comments

Comments
 (0)