trailpack-proxy-generics
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -220,3 +220,20 @@ 'use strict' | ||
} | ||
/** | ||
* | ||
* @param source | ||
* @param adapter | ||
* @returns {*|Promise.<TResult>} | ||
*/ | ||
removeCustomerSource(source, adapter){ | ||
return lib.Validator.validatePaymentProvider.removeCustomerSource(source) | ||
.then(values => { | ||
adapter = this._init(adapter) | ||
return adapter.removeCustomerSource(source) | ||
.then(source => { | ||
return lib.Validator.validatePaymentProvider.removeCustomerSourceSuccess(source) | ||
}) | ||
}) | ||
} | ||
} | ||
@@ -25,1 +25,3 @@ exports.authorize = require('./authorize') | ||
exports.updateCustomerSourceSuccess = require('./updateCustomerSourceSuccess') | ||
exports.removeCustomerSource = require('./removeCustomerSource') | ||
exports.removeCustomerSourceSuccess = require('./removeCustomerSourceSuccess') |
@@ -344,2 +344,22 @@ 'use sticy' | ||
}, | ||
removeCustomerSource: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.paymentProvider.removeCustomerSource, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
removeCustomerSourceSuccess: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.paymentProvider.removeCustomerSourceSuccess, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
void: (config) => { | ||
@@ -346,0 +366,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "trailpack-proxy-generics", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "Generics - Trailpack for Proxy Engine", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cali-style.com", |
@@ -133,2 +133,13 @@ 'use strict' | ||
} | ||
removeCustomerSource(source) { | ||
const res = { | ||
gateway: 'payment_processor', | ||
account_foreign_id: source.account_foreign_id, | ||
account_foreign_key: 'customer', | ||
foreign_key: 'source', | ||
foreign_id: source.foreign_id, | ||
payment_details: source | ||
} | ||
return Promise.resolve(res) | ||
} | ||
} |
@@ -138,2 +138,15 @@ 'use strict' | ||
}) | ||
it('should remove customer source', (done) => { | ||
PaymentGenericService.removeCustomerSource({ | ||
account_foreign_id: 1, | ||
foreign_id: 1 | ||
}) | ||
.then(source => { | ||
done() | ||
}) | ||
.catch(err => { | ||
done(err) | ||
}) | ||
}) | ||
}) |
94376
132
3012