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

Add stripe business accounts #980

Merged
merged 15 commits into from
Jan 7, 2019
Merged

Conversation

OtterleyW
Copy link
Contributor

@OtterleyW OtterleyW commented Dec 17, 2018

PayoutDetailsForm is now divided to multiple smaller subcomponents:

  • PayoutDetailsCompany and PayoutDetailsIndividual contain needed fields for individual and company accounts
  • PayoutDetailsAddress ,PayoutDetailsBankDetails and PayoutDetailsPersonalDetails specific fields related to address, bank details and personal details

New FieldArray component is created for adding multiple additional owners if needed.

Select individual or company account

fieldradiobutton

Add additional owners

additionalowners3

@OtterleyW OtterleyW force-pushed the add-stripe-business-accounts branch 11 times, most recently from b50df40 to 8b16f86 Compare December 21, 2018 13:35
@OtterleyW OtterleyW requested a review from Gnito December 21, 2018 14:21
disabled: bool,
fieldId: string,

// from injectIntl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw. this is a bit confusing comment since there is no injectIntl (higher order component) used in this file.

.root {
}

.formRow {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used.

margin-bottom: 24px;
}

.field {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is not used either.

.field {
width: 100%;
}
.buttonsWrapper button {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in the example only. (We try to keep example/styleguide CSS out of main component CSS by having separate ComponentName.example.css file).

Another thing to note: we don't want to refer to elements anywhere except in marketplaceIndex.css file - add classes instead.

const classes = classNames(rootClassName || css.root, className);

return (
<FieldArray id={id} name={name} className={classes}>
Copy link
Contributor

@Gnito Gnito Dec 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I don't think it makes much sense for this to exists as a separate component (FieldArray wrapper for FieldArray). There are no styles attached to this component (and the styles are likely to be different in different use scenarios when import { FieldArray } from 'react-final-form-arrays'; is used.

It is also good to note that every time, when FieldArrays are used inside Final Form, the form needs to pass arrayMutators as props to the FinalForm component itself. So, wrapping the usage of react-final-form-arrays library with separate component like this one might be a bit confusing since it doesn't work out of the box.

const classes = classNames(rootClassName || css.root, className);

// Use given size as width and height or default to 12px
const svgSize = size ? size : 12;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit of catch when sizing SVG icons with width and height. They render graphics (paths, rects, circles etc.) to their own inner viewbox (or should I say coordinate system).

There's one problem with this concept related to line graphics: if the width of the icon is scaled down, also the line width is scaled down accordingly. So, it is unlikely that the width of the line matches with the width our designer intended it to be. (This is the reason why we have different SVG graphics for different sizes in IconArrowHead.js

payoutDetailValues = payoutDetails['company'];
} else if (accountType === 'individual') {
payoutDetailValues = payoutDetails['individual'];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK but can be achieved with ternary too.

id: 'PayoutDetailsForm.firstNameRequired',
})
);
const { country } = values;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could extract accountType here too since it is used later.

/>
</div>
{values.accountType ? (
<React.Fragment>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


const hasAdditionalOwners = values.company && values.company.additionalOwners;
const hasMaxNumberOfAdditionalOwners =
hasAdditionalOwners && values.company.additionalOwners.length >= 4;
Copy link
Contributor

@Gnito Gnito Dec 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to use magic numbers in the code. So, I'd suggest that this number is either

  1. coming from config: maxNumberOfAdditionalOwners (might be unnecessary if the value is just 4 or nothing) or
  2. it is a constant defined at the beginning of this file:
// In EU, there can be a maximum of 4 additional owners
const MAX_NUMBER_OF_ADDITIONAL_OWNERS = 4;

Copy link
Contributor

@Gnito Gnito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it how much easier this is to read and configure after separating individual and company sections and adding more sub components.

I added quite many change request related to code-conventions we use (and pointed some unused code), but actually, this looks pretty good 👍

@OtterleyW OtterleyW force-pushed the add-stripe-business-accounts branch 2 times, most recently from 887b4de to 0a35c58 Compare January 2, 2019 13:18
Copy link
Contributor

@Gnito Gnito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, check Janne's opinion before merging

@OtterleyW OtterleyW temporarily deployed to sharetribe-starter-app January 2, 2019 14:46 Inactive
@OtterleyW OtterleyW force-pushed the add-stripe-business-accounts branch 5 times, most recently from d2924ca to 2d64a5a Compare January 7, 2019 12:02
@OtterleyW OtterleyW merged commit 400a0d3 into master Jan 7, 2019
@OtterleyW OtterleyW deleted the add-stripe-business-accounts branch January 7, 2019 12:40
@Gnito Gnito mentioned this pull request Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants