text: import MultiForm from '../multiform'
  import PropTypes from 'prop-types'
  import Complete from './complete'
  import Payment from './payment'
  import Cart from '../cart'
  import React from 'react'
  
  class Checkout extends React.Component {
  
    static propTypes = {
      action: PropTypes.string,
      cart: PropTypes.object,
      defaultValue: PropTypes.object,
      method: PropTypes.object,
      endpoint: PropTypes.string,
      itemFormat: PropTypes.any,
      getSteps: PropTypes.func,
      props: PropTypes.object,
      token: PropTypes.string,
      onDone: PropTypes.func,
      onSuccess: PropTypes.func
    }
  
    static defaultProps = {
      onDone: () => {},
      onSuccess: () => {}
    }
  
    render() {
      return (
        <div className="maha-checkout">
          <div className="maha-checkout-main">
            <MultiForm { ...this._getMultiForm() } />
          </div>
          <div className="maha-checkout-sidebar">
            <Cart { ...this._getCart() } />
          </div>
        </div>
      )
    }
  
    _getMultiForm() {
      const { action, cart, defaultValue, endpoint, method, props, token, onDone, onSuccess } = this.props
      return {
        action,
        defaultValue,
        endpoint,
        method,
        props: {
          ...props || {},
          action,
          cart,
          token
        },
        getSteps: this._getSteps.bind(this),
        onDone,
        onSuccess
      }
    }
  
    _getCart() {
      const { cart, itemFormat } = this.props
      return {
        ...cart,
        format: itemFormat
      }
    }
  
    _getData(store) {
      return {
        confirmation: store.confirmation,
        contact_config: store.contact_config,
        permalink: store.permalink,
        program_id: store.program.id,
        title: store.title
      }
    }
  
    _getSteps(formdata) {
      const steps = this.props.getSteps(formdata)
      return [
        ...steps,
        { label: 'Payment Information', component: Payment },
        { label: 'Checkout Complete', component: Complete }
      ]
    }
  
  }
  
  export default Checkout
  