/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Component, Fragment } from '@wordpress/element'; import { Button } from '@wordpress/components'; import interpolateComponents from 'interpolate-components'; import { compose } from '@wordpress/compose'; import { withDispatch, withSelect } from '@wordpress/data'; import { Form, Link, Stepper, TextControl } from '@woocommerce/components'; import { OPTIONS_STORE_NAME } from '@woocommerce/data'; class EWay extends Component { getInitialConfigValues = () => { return { customer_api: '', customer_password: '', }; }; validate = ( values ) => { const errors = {}; if ( ! values.customer_api ) { errors.customer_api = __( 'Please enter your customer API key ', 'woocommerce-admin' ); } if ( ! values.customer_password ) { errors.customer_password = __( 'Please enter your customer password', 'woocommerce-admin' ); } return errors; }; updateSettings = async ( values ) => { const { updateOptions, createNotice, markConfigured } = this.props; const update = await updateOptions( { woocommerce_eway_settings: { customer_api: values.customer_api, customer_password: values.customer_password, enabled: 'yes', }, } ); if ( update.success ) { markConfigured( 'eway' ); createNotice( 'success', __( 'eWAY connected successfully', 'woocommerce-admin' ) ); } else { createNotice( 'error', __( 'There was a problem saving your payment settings', 'woocommerce-admin' ) ); } }; renderConnectStep() { const { isOptionsRequesting } = this.props; const helpText = interpolateComponents( { mixedString: __( 'Your API details can be obtained from your {{link}}eWAY account{{/link}}', 'woocommerce-admin' ), components: { link: ( ), }, } ); return (
); } render() { const { installStep, isOptionsRequesting } = this.props; return (