refactor(auth): rename paymentBridge → signupBridge
After commit 90acc35 issued the cookie for $0 signups too, the "payment"
framing was wrong — there's no payment in a $0 signup. The cookie is
about bridging the gap between signup-form submit and email verify, not
about payment specifically.
Changes:
- setPaymentBridgeCookie → setSignupBridgeCookie
- getPaymentBridgeMember → getSignupBridgeMember
- Cookie wire name payment-bridge → signup-bridge
- JWT scope payment_bridge → signup_bridge
Touches both /api/helcim/subscription (signup activation) and
/api/helcim/initialize-payment (paid Helcim checkout) which both consume
the cookie. In-flight signup sessions started before this lands will
need to re-submit the form (cookie name mismatch); cutover hasn't
happened yet, so the only impact is local dev sessions.
This commit is contained in:
parent
c6a5e25d06
commit
9b79ae6bf4
8 changed files with 36 additions and 35 deletions
|
|
@ -60,9 +60,9 @@ const SUBSCRIPTION_BODY = {
|
|||
function extractBridgeCookie(event) {
|
||||
const setCookie = event.node.res.getHeader('set-cookie')
|
||||
const cookies = Array.isArray(setCookie) ? setCookie : [setCookie].filter(Boolean)
|
||||
const match = cookies.find(c => typeof c === 'string' && c.startsWith('payment-bridge='))
|
||||
const match = cookies.find(c => typeof c === 'string' && c.startsWith('signup-bridge='))
|
||||
if (!match) return null
|
||||
return match.match(/payment-bridge=([^;]+)/)[1]
|
||||
return match.match(/signup-bridge=([^;]+)/)[1]
|
||||
}
|
||||
|
||||
describe('signup → subscription bridge-cookie hand-off', () => {
|
||||
|
|
@ -104,7 +104,7 @@ describe('signup → subscription bridge-cookie hand-off', () => {
|
|||
expect(result1.member.status).toBe('pending_payment')
|
||||
|
||||
const bridgeToken = extractBridgeCookie(customerEvent)
|
||||
expect(bridgeToken, 'payment-bridge cookie missing on $0 signup').toBeTruthy()
|
||||
expect(bridgeToken, 'signup-bridge cookie missing on $0 signup').toBeTruthy()
|
||||
|
||||
Member.findOneAndUpdate.mockResolvedValue({ _id: MEMBER_ID, status: 'pending_payment' })
|
||||
Member.findById.mockResolvedValue({
|
||||
|
|
@ -120,7 +120,7 @@ describe('signup → subscription bridge-cookie hand-off', () => {
|
|||
method: 'POST',
|
||||
path: '/api/helcim/subscription',
|
||||
headers: { origin: ALLOWED_ORIGIN },
|
||||
cookies: { 'payment-bridge': bridgeToken },
|
||||
cookies: { 'signup-bridge': bridgeToken },
|
||||
body: SUBSCRIPTION_BODY
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue