Skip to content
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 @@ -71,9 +71,8 @@ export const PaymentGatewaySelect = (props: {
return await redirectToStripeDropin({
paymentGatewayId: data.paymentGatewayId,
});

break;
}
case "app.saleor.adyen_staging":
case "app.saleor.adyen": {
toast({
title: "Payment gateway selected",
Expand All @@ -85,6 +84,12 @@ export const PaymentGatewaySelect = (props: {
});
}
default: {
toast({
title: "Not supported payment gateway",
description: `The payment gateway ${data.paymentGatewayId} is not supported.`,
variant: "destructive",
});

throw new Error(
"Payment gateway is not supported. Check either app.saleor.stripe or app.saleor.adyen",
);
Expand Down
15 changes: 5 additions & 10 deletions src/modules/stripe/components/stripe-checkout-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { loadStripe } from "@stripe/stripe-js";
import { useState } from "react";

import { Button } from "@/components/ui/button";
import { FormButton } from "@/components/form-button";
import { toast } from "@/components/ui/use-toast";
import { BaseError } from "@/lib/errors";
import { createPath } from "@/lib/utils";
Expand Down Expand Up @@ -165,20 +165,15 @@ export const StripeCheckoutFormWrapped = (props: {
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
<PaymentElement />
<div className="flex justify-stretch">
<Button
<FormButton
type="submit"
className="w-full"
disabled={!stripe || !elements}
data-testid="button-pay"
loading={loading}
>
{loading ? (
<>Loading...</>
) : (
<>
Pay {props.saleorAmount} {props.currency}
</>
)}
</Button>
Pay {props.saleorAmount} {props.currency}
</FormButton>
</div>
</form>
);
Expand Down