Purpose: To discover the interface for Gateway Services Protocol to be extended per a given use case
In gatewaydfile.js
:
module.exports = function(gatewayd) {
gatewayd.protocol.external.outbound.extend({
quote: function(options, resolve, reject) {
if (gatewayd.validator.isEmail(address)) {
if (options.currency === 'BTC') {
if (options.amount <= 0.1) {
resolve({
destination: options.destination,
amount: options.amount * 1.01,
currency: options.currency
});
} else {
reject(new Error('amount must be less than 0.1'));
}
} else {
reject(new Error('currency must be BTC'));
}
} else {
reject(new Error('address must be email'));
}
}
});
};