ghost-payment-service
Advanced tools
Comparing version 1.2.6 to 1.2.7
@@ -120,3 +120,3 @@ 'use strict'; | ||
.then(result => { | ||
if (!result._original || result._original.errors) reject(this._buildChargeError(result._original.errors)); | ||
if (!result._original || result._original.errors) reject(AuthorizeNetService._buildChargeError(result._original.errors)); | ||
resolve(_.mapValues(result._original, (val) => _.head(val))); // auth net returns an object where each value is an array, map to normal object | ||
@@ -181,5 +181,3 @@ }) | ||
return _.map(paymentProfiles, paymentProfile => { | ||
console.log('paymentProfile', paymentProfile); | ||
return { | ||
@@ -226,3 +224,3 @@ customerPaymentProfileId: _.get(paymentProfile, 'customerPaymentProfileId', null), | ||
.catch(err => { | ||
if (moment(data.createdAt).add('2', 'days').isAfter(moment()) && err.message == 'The referenced transaction does not meet the criteria for issuing a credit.') { | ||
if (moment(data.createdAt).add('2', 'days').isAfter(moment()) && err.message === 'The referenced transaction does not meet the criteria for issuing a credit.') { | ||
return resolve(this._authorizeClient.voidTransaction(data.paymentId)); | ||
@@ -241,3 +239,3 @@ } else { | ||
static _buildChargeError (errors) { | ||
if (!Array.isArray(errors) || !errors.length || !errors[0].error[0].errorText) return 'Unable to complete transaction.'; | ||
if (!_.isArray(errors) || _.isEmpty(errors) || !errors[0].error[0].errorText) return 'Unable to complete transaction.'; | ||
return errors[0].error[0].errorText; | ||
@@ -244,0 +242,0 @@ } |
{ | ||
"name": "ghost-payment-service", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "nodejs client to interact with the authorize.net & stripe apis", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43519
1212