Skip to content

Commit

Permalink
fix(stripepaymentcheckoutaction): set isStripeFormComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Machiko Yasuda committed Nov 7, 2018
1 parent e9df0c2 commit 27ee2b9
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class StripePaymentCheckoutAction extends Component {
activeCountry: "US",
status: "active",
billingAddress: "same_as_shipping",
isStripeFormComplete: false,
countries: [
{ value: "US", label: "United States" },
{ value: "DE", label: "Germany" },
Expand Down Expand Up @@ -163,20 +164,26 @@ class StripePaymentCheckoutAction extends Component {
}

handleUseNewBillingAddress = (billingAddress) => {
const { isStripeFormComplete } = this.state;
if (billingAddress === "use_different_billing_address") {
this.setState({ billingAddress });
} else if (billingAddress === "same_as_shipping") {
// If a user decides to use the same address
this.setState({ billingAddress });
// Confirm if Stripe Form is filled out
// to trigger onReadyForSaveChange()
this.handleStripeFormIsComplete();
if (isStripeFormComplete) {
// Trigger onReadyForSaveChange()
this.handleStripeFormIsComplete(true);
}
}
}

handleStripeFormIsComplete = (isComplete) => {
const { onReadyForSaveChange } = this.props;
onReadyForSaveChange(isComplete);
this.setState({
isStripeFormComplete: true
});
}

renderBillingAddressForm = () => {
Expand Down

0 comments on commit 27ee2b9

Please sign in to comment.