Skip to content

Commit

Permalink
Small changes to StripePaymentForm
Browse files Browse the repository at this point in the history
  • Loading branch information
OtterleyW committed May 21, 2019
1 parent 8e1076a commit d0ae3db
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 37 deletions.
7 changes: 6 additions & 1 deletion src/containers/CheckoutPage/CheckoutPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ export class CheckoutPageComponent extends Component {
);
}

const userName =
currentUser && currentUser.attributes
? `${currentUser.attributes.profile.firstName} ${currentUser.attributes.profile.lastName}`
: null;

return (
<Page {...pageProps}>
{topbar}
Expand Down Expand Up @@ -554,7 +559,7 @@ export class CheckoutPageComponent extends Component {
errors={{
handleCardPaymentError,
}}
currentUser={currentUser}
initialValues={{ name: userName }}
/>
) : null}
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,18 @@ exports[`CheckoutPage matches snapshot 1`] = `
<section>
<InjectIntl(StripePaymentForm)
authorDisplayName="author display name"
currentUser={
Object {
"attributes": Object {
"banned": false,
"deleted": false,
"email": "[email protected]",
"emailVerified": true,
"profile": Object {
"abbreviatedName": "currentUser abbreviated name",
"displayName": "currentUser display name",
"firstName": "currentUser first name",
"lastName": "currentUser last name",
},
},
"id": UUID {
"_sdkType": "UUID",
"uuid": "currentUser",
},
"type": "currentUser",
}
}
errors={
Object {
"handleCardPaymentError": undefined,
}
}
formId="CheckoutPagePaymentForm"
inProgress={false}
initialValues={
Object {
"name": "currentUser first name currentUser last name",
}
}
onSubmit={[Function]}
paymentInfo="CheckoutPage.paymentInfo"
showInitialMessageInput={true}
Expand Down
2 changes: 1 addition & 1 deletion src/forms/StripePaymentForm/StripePaymentAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const StripePaymentAddress = props => {

<FieldSelect
id={`${fieldId}.country`}
name={`${fieldId}.country`}
name="country"
disabled={disabled}
className={css.selectCountry}
label={countryLabel}
Expand Down
15 changes: 1 addition & 14 deletions src/forms/StripePaymentForm/StripePaymentForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,20 +306,7 @@ class StripePaymentForm extends Component {

render() {
const { onSubmit, ...rest } = this.props;
const currentUser = this.props.currentUser;
const userName =
currentUser && currentUser.attributes
? `${currentUser.attributes.profile.firstName} ${currentUser.attributes.profile.lastName}`
: null;

return (
<FinalForm
onSubmit={this.handleSubmit}
{...rest}
render={this.paymentForm}
initialValues={{ name: userName }}
/>
);
return <FinalForm onSubmit={this.handleSubmit} {...rest} render={this.paymentForm} />;
}
}

Expand Down

0 comments on commit d0ae3db

Please sign in to comment.