trailpack-proxy-generics
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -126,2 +126,19 @@ 'use strict' | ||
*/ | ||
findCustomer(customer, adapter){ | ||
return lib.Validator.validatePaymentProvider.findCustomer(customer) | ||
.then(values => { | ||
adapter = this._init(adapter) | ||
return adapter.findCustomer(customer) | ||
.then(customer => { | ||
return lib.Validator.validatePaymentProvider.findCustomerSuccess(customer) | ||
}) | ||
}) | ||
} | ||
/** | ||
* | ||
* @param customer | ||
* @param adapter | ||
* @returns {*|Promise.<TResult>} | ||
*/ | ||
updateCustomer(customer, adapter){ | ||
@@ -154,2 +171,18 @@ return lib.Validator.validatePaymentProvider.updateCustomer(customer) | ||
} | ||
/** | ||
* | ||
* @param customer | ||
* @param adapter | ||
* @returns {*|Promise.<TResult>} | ||
*/ | ||
findCustomerSource(source, adapter){ | ||
return lib.Validator.validatePaymentProvider.findCustomerSource(source) | ||
.then(values => { | ||
adapter = this._init(adapter) | ||
return adapter.findCustomerSource(source) | ||
.then(source => { | ||
return lib.Validator.validatePaymentProvider.findCustomerSourceSuccess(source) | ||
}) | ||
}) | ||
} | ||
@@ -156,0 +189,0 @@ /** |
@@ -5,2 +5,5 @@ 'use strict' | ||
// TODO schema | ||
module.exports = joi.object() | ||
module.exports = joi.object().keys({ | ||
account_foreign_id: joi.any().required(), | ||
token: joi.any().required() | ||
}) |
@@ -5,2 +5,7 @@ 'use strict' | ||
// TODO schema | ||
module.exports = joi.object() | ||
module.exports = joi.object().keys({ | ||
gateway: joi.string(), | ||
foreign_key: joi.any(), | ||
foreign_id: joi.any(), | ||
data: joi.object() | ||
}).unknown() |
@@ -7,3 +7,5 @@ 'use strict' | ||
gateway: joi.string(), | ||
foreign_key: joi.any(), | ||
foreign_id: joi.any(), | ||
data: joi.object() | ||
}).unknown() |
@@ -9,2 +9,6 @@ exports.authorize = require('./authorize') | ||
exports.createCustomerSourceSuccess = require('./createCustomerSourceSuccess') | ||
exports.findCustomer = require('./findCustomer') | ||
exports.findCustomerSuccess = require('./findCustomerSuccess') | ||
exports.findCustomerSource = require('./findCustomerSource') | ||
exports.findCustomerSourceSuccess = require('./findCustomerSourceSuccess') | ||
exports.sale = require('./sale') | ||
@@ -11,0 +15,0 @@ exports.saleSuccess = require('./saleSuccess') |
'use strict' | ||
const joi = require('joi') | ||
// TODO schema | ||
module.exports = joi.object() | ||
module.exports = joi.object().keys({ | ||
foreign_key: joi.any(), | ||
foreign_id: joi.any().required(), | ||
}).unknown() |
'use strict' | ||
const joi = require('joi') | ||
// TODO schema | ||
module.exports = joi.object() | ||
module.exports = joi.object().keys({ | ||
account_foreign_id: joi.any().required(), | ||
foreign_id: joi.any().required(), | ||
}).unknown() |
'use strict' | ||
const joi = require('joi') | ||
// TODO schema | ||
module.exports = joi.object() | ||
module.exports = joi.object().keys({ | ||
gateway: joi.string(), | ||
foreign_key: joi.any(), | ||
foreign_id: joi.any(), | ||
data: joi.object() | ||
}).unknown() |
'use strict' | ||
const joi = require('joi') | ||
// TODO schema | ||
module.exports = joi.object() | ||
module.exports = joi.object().keys({ | ||
gateway: joi.string(), | ||
foreign_key: joi.any(), | ||
foreign_id: joi.any(), | ||
data: joi.object() | ||
}).unknown() |
@@ -224,2 +224,42 @@ 'use sticy' | ||
}, | ||
findCustomer: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.paymentProvider.findCustomer, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
findCustomerSuccess: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.paymentProvider.findCustomerSuccess, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
findCustomerSource: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.paymentProvider.findCustomerSource, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
findCustomerSourceSuccess: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.paymentProvider.findCustomerSourceSuccess, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
sale: (config) => { | ||
@@ -226,0 +266,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "trailpack-proxy-generics", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Generics - Trailpack for Proxy Engine", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cali-style.com", |
86962
128
2772