Skip to content

Commit

Permalink
Merge pull request #847 from Automattic/update/send-billing-info-to-t…
Browse files Browse the repository at this point in the history
…ransaction-endpoint

Checkout: Send billing info to transaction endpoint
  • Loading branch information
janm6k committed Nov 27, 2015
2 parents 758c146 + 4eae543 commit 915d1e3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client/lib/store-transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TransactionFlow.prototype._pushStep = function( options ) {
};

this.push( Object.assign( defaults, options ) );
}
};

TransactionFlow.prototype._paymentHandlers = {
'WPCOM_Billing_MoneyPress_Stored': function() {
Expand All @@ -90,7 +90,9 @@ TransactionFlow.prototype._paymentHandlers = {
},

'WPCOM_Billing_MoneyPress_Paygate': function() {
var validation = validateCardDetails( this._initialData.payment.newCardDetails );
const { newCardDetails } = this._initialData.payment,
validation = validateCardDetails( newCardDetails );

if ( ! isEmpty( validation.errors ) ) {
this._pushStep( {
name: 'input-validation',
Expand All @@ -103,10 +105,16 @@ TransactionFlow.prototype._paymentHandlers = {

this._pushStep( { name: 'input-validation', first: true } );
debug( 'submitting transaction with new card' );

this._createPaygateToken( function( paygateToken ) {
const { name, country, 'postal-code': zip } = newCardDetails;

this._submitWithPayment( {
payment_method: 'WPCOM_Billing_MoneyPress_Paygate',
payment_key: paygateToken
payment_key: paygateToken,
name,
zip,
country
} );
}.bind( this ) );
},
Expand Down

0 comments on commit 915d1e3

Please sign in to comment.