Skip to content

Instantly share code, notes, and snippets.

@diegovdev
Forked from owenkellogg/outbound.md
Last active August 29, 2015 14:26
Show Gist options
  • Save diegovdev/c436e76673b7ba234ca5 to your computer and use it in GitHub Desktop.
Save diegovdev/c436e76673b7ba234ca5 to your computer and use it in GitHub Desktop.
Gatewayd Protocol Outbound External

Outbound Coingate

Purpose: To discover the interface for Gateway Services Protocol to be extended per a given use case

gatewayd.protocol.external.outbound.extend({
  quote: function(address, amount, currency) {
  
    if (gatewayd.validator.isEmail(address)) {
      if (currency === 'BTC') {
        if (amount <= 0.1) {
          this.resolve({
            destination: destination,
            amount: amount,
            currency: currency
          });
        } else {
          this.reject(new Error('amount must be less than 0.1'));
        }
      } else {
        this.reject(new Error('currency must be BTC'));
      }
    } else {
      this.reject(new Error('address must be email'));
    }
  }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment