-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathaccount-payment-form.jsx
More file actions
53 lines (49 loc) · 1.87 KB
/
account-payment-form.jsx
File metadata and controls
53 lines (49 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (c) 2025, Salesforce, Inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import React from 'react'
import PropTypes from 'prop-types'
import {FormattedMessage} from 'react-intl'
import {Box, Stack} from '@salesforce/retail-react-app/app/components/shared/ui'
import CreditCardFields from '@salesforce/retail-react-app/app/components/forms/credit-card-fields'
import Field from '@salesforce/retail-react-app/app/components/field'
/**
* AccountPaymentForm
* A minimal payment form for the Account > Payment Methods page.
* Renders only the credit card fields and any provided children (e.g., action buttons).
*/
const AccountPaymentForm = ({form, onSubmit, children}) => {
return (
<form onSubmit={form.handleSubmit(onSubmit)}>
<Stack spacing={6}>
<Box>
<Stack spacing={6}>
<CreditCardFields form={form} />
<Field
name="default"
label={
<FormattedMessage
defaultMessage="Set as default"
id="account.payments.checkbox.make_default"
/>
}
type="checkbox"
defaultValue={false}
control={form.control}
/>
{children && <Box pt={2}>{children}</Box>}
</Stack>
</Box>
</Stack>
</form>
)
}
AccountPaymentForm.propTypes = {
form: PropTypes.object,
onSubmit: PropTypes.func,
children: PropTypes.node
}
export default AccountPaymentForm