-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow for BAT payments via hosted checkout (#827)
* wip: allow for BAT payments via hosted checkout * Allow for change of payment method in draft * fix: seperate payment method * fix: redirect to settings
- Loading branch information
1 parent
0c2ed46
commit e17d80f
Showing
13 changed files
with
83 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/user/views/adsManager/views/advanced/components/campaign/BudgetSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react"; | ||
import { BudgetField } from "user/views/adsManager/views/advanced/components/campaign/fields/BudgetField"; | ||
import { PaymentMethodField } from "user/views/adsManager/views/advanced/components/campaign/fields/PaymentMethodField"; | ||
|
||
export function BudgetSettings(props: { isEdit: boolean }) { | ||
return ( | ||
<> | ||
<BudgetField isEdit={props.isEdit} /> | ||
|
||
<PaymentMethodField isEdit={props.isEdit} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/user/views/adsManager/views/advanced/components/campaign/fields/PaymentMethodField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Stack, Typography } from "@mui/material"; | ||
import { FormikRadioControl } from "form/FormikHelpers"; | ||
import { PaymentType } from "graphql/types"; | ||
import React from "react"; | ||
import { useFormikContext } from "formik"; | ||
import { CampaignForm } from "user/views/adsManager/types"; | ||
import { useAdvertiser } from "auth/hooks/queries/useAdvertiser"; | ||
import { CardContainer } from "components/Card/CardContainer"; | ||
|
||
interface Props { | ||
isEdit: boolean; | ||
} | ||
|
||
export function PaymentMethodField({ isEdit }: Props) { | ||
const { values } = useFormikContext<CampaignForm>(); | ||
const { advertiser } = useAdvertiser(); | ||
|
||
if (advertiser.selfServiceSetPrice) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<CardContainer header="Payment Method"> | ||
<Stack spacing={1}> | ||
<Typography variant="body2"> | ||
Prepayment of the campaign budget is required before your campaign can | ||
begin. | ||
</Typography> | ||
<FormikRadioControl | ||
disabled={isEdit && values.state !== "draft"} | ||
name="paymentType" | ||
options={[ | ||
{ label: "USD", value: advertiser.selfServicePaymentType }, | ||
{ label: "BAT", value: PaymentType.Radom }, | ||
]} | ||
/> | ||
</Stack> | ||
</CardContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters