@@ -87,6 +87,10 @@ class Checkout extends React.Component {
8787 ) ;
8888 } ;
8989
90+ handleSubmitStripe = ( formData ) => {
91+ this . props . submitPayment ( { method : 'stripe' , ...formData } ) ;
92+ } ;
93+
9094 handleSubmitStripeButtonClick = ( ) => {
9195 sendTrackEvent (
9296 'edx.bi.ecommerce.basket.payment_selected' ,
@@ -210,15 +214,8 @@ class Checkout extends React.Component {
210214
211215 const basketClassName = 'basket-section' ;
212216
213- // TODO: fix loading, enableStripePaymentProcessor and clientSecretId distinction
214- // 1. loading should be renamed to loadingBasket
215- // 2. enableStripePaymentProcessor can be temporarily false while loading is true
216- // since the flag is in the BFF basket endpoint. Possibly change this?
217- // 3. Right now when fetching capture context, CyberSource's captureKey is saved as clientSecretId
217+ // TODO: Right now when fetching capture context, CyberSource's captureKey is saved as clientSecretId
218218 // so we cannot rely on !options.clientSecret to distinguish btw payment processors
219- // 4. There is a delay from when the basket is done loading (plus the flag value)
220- // and when we get the clientSecretId so there is a point in time when loading skeleton
221- // is hidden but the Stripe billing and credit card fields are not shown
222219 const shouldDisplayStripePaymentForm = ! loading && enableStripePaymentProcessor && options . clientSecret ;
223220 const shouldDisplayCyberSourcePaymentForm = ! loading && ! enableStripePaymentProcessor ;
224221
@@ -271,14 +268,11 @@ class Checkout extends React.Component {
271268 < Elements options = { options } stripe = { stripePromise } >
272269 < StripePaymentForm
273270 options = { options }
271+ onSubmitPayment = { this . handleSubmitStripe }
274272 onSubmitButtonClick = { this . handleSubmitStripeButtonClick }
275- disabled = { submitting }
276273 isBulkOrder = { isBulkOrder }
277274 isProcessing = { stripeIsSubmitting }
278- loading = { loading }
279275 isQuantityUpdating = { isQuantityUpdating }
280- enableStripePaymentProcessor = { enableStripePaymentProcessor }
281- products = { this . props . products }
282276 />
283277 </ Elements >
284278 ) : ( loading && ( this . renderBillingFormSkeleton ( ) ) ) }
@@ -321,11 +315,10 @@ Checkout.propTypes = {
321315 isFreeBasket : PropTypes . bool ,
322316 submitting : PropTypes . bool ,
323317 isBasketProcessing : PropTypes . bool ,
324- paymentMethod : PropTypes . oneOf ( [ 'paypal' , 'apple-pay' , 'cybersource' ] ) ,
318+ paymentMethod : PropTypes . oneOf ( [ 'paypal' , 'apple-pay' , 'cybersource' , 'stripe' ] ) ,
325319 orderType : PropTypes . oneOf ( Object . values ( ORDER_TYPES ) ) ,
326320 enableStripePaymentProcessor : PropTypes . bool ,
327321 clientSecretId : PropTypes . string ,
328- products : PropTypes . array , // eslint-disable-line react/forbid-prop-types,
329322} ;
330323
331324Checkout . defaultProps = {
@@ -338,7 +331,6 @@ Checkout.defaultProps = {
338331 orderType : ORDER_TYPES . SEAT ,
339332 enableStripePaymentProcessor : false ,
340333 clientSecretId : null ,
341- products : [ ] ,
342334} ;
343335
344336const mapStateToProps = ( state ) => ( {
0 commit comments