Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More cleanly transition to mandatory :payment_integration parameter in URL #10477

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function PaymentStep({
elements,
clientSecret,
confirmParams: {
return_url: paymentFinishUrl(competitionInfo.id),
return_url: paymentFinishUrl(competitionInfo.id, 'stripe'),
},
});

Expand Down
2 changes: 1 addition & 1 deletion app/webpacker/lib/requests/routes.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const adminFixResultsUrl = (personId, competition_id = undefined, event_i
return `<%= CGI.unescape(Rails.application.routes.url_helpers.admin_fix_results_path) %>?${searchParams.toString()}`
};

export const paymentFinishUrl = (competitionId) => `<%= CGI.unescape(Rails.application.routes.url_helpers.registration_payment_completion_url("${competitionId}", host: EnvConfig.ROOT_URL)) %>`
export const paymentFinishUrl = (competitionId, paymentIntegration) => `<%= CGI.unescape(Rails.application.routes.url_helpers.registration_payment_completion_url("${competitionId}", "${paymentIntegration}", host: EnvConfig.ROOT_URL)) %>`

export const availableRefundsUrl = (competitionId, userId) => `<%= CGI.unescape(Rails.application.routes.url_helpers.refunds_path) %>?attendee_id=${competitionId}-${userId}`

Expand Down
1 change: 1 addition & 0 deletions spec/controllers/registrations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
)
get :payment_completion, params: {
competition_id: competition.id,
payment_integration: :stripe,
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down
28 changes: 14 additions & 14 deletions spec/requests/registrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@
stripe_account: competition.payment_account_for(:stripe).account_id,
)
# mimic the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -655,7 +655,7 @@
stripe_account: competition.payment_account_for(:stripe).account_id,
)
# mimic the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -688,7 +688,7 @@
stripe_account: competition.payment_account_for(:stripe).account_id,
)
# mimic the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -723,7 +723,7 @@
stripe_account: competition.payment_account_for(:stripe).account_id,
)
# mimic the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -757,7 +757,7 @@
)

# mimic the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -794,7 +794,7 @@

expect {
# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -824,7 +824,7 @@

expect {
# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -854,7 +854,7 @@

expect {
# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -884,7 +884,7 @@

expect {
# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand All @@ -911,7 +911,7 @@
stripe_account: competition.payment_account_for(:stripe).account_id,
)
# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -947,7 +947,7 @@
}.to raise_error(Stripe::StripeError, "Your card was declined.")

# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -989,7 +989,7 @@
}.to raise_error(Stripe::StripeError, "Your card was declined.")

# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -1036,7 +1036,7 @@
}.to raise_error(Stripe::StripeError, "Your card was declined.")

# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down Expand Up @@ -1082,7 +1082,7 @@
)

# mimick the response that Stripe sends to our return_url after completing the checkout UI
get registration_payment_completion_path(competition.id), params: {
get registration_payment_completion_path(competition.id, :stripe), params: {
payment_intent: payment_intent.payment_record.stripe_id,
payment_intent_client_secret: payment_intent.client_secret,
}
Expand Down
Loading