Created
December 15, 2014 19:55
-
-
Save owenkellogg/7557b85a07f0d31ced47 to your computer and use it in GitHub Desktop.
bridge_services_lib.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Service = require('bridge-quote-service') | |
var RipplePaymentQuote = Service.RipplePaymentQuote | |
var ExternalPaymentQuote = Service.ExternalPaymentQuote | |
var BridgeQuote = Service.BridgeQuote | |
var RippleQuote = RipplePaymentQuote.extend({ | |
authorize: function(payment) { | |
if (payment.to_currency !== 'XRP') { | |
this.reject('Destination Currency Must be XRP') | |
} | |
}, | |
inbound: { | |
source: { | |
address: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk' | |
} | |
}, | |
outbound: { | |
destination: { | |
address: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk' | |
} | |
}, | |
rippleRest: 'https://api.ripple.com' | |
}) | |
var ExternalQuote = ExternalPaymentQuote.extend({ | |
build: function(payment) { | |
this.resolve(payment) | |
} | |
}) | |
var BridgeQuote = BridgeQuote.extend({ | |
ripple: RippleQuote, | |
external: ExternalQuote | |
}) | |
var bridgeQuote = new BridgeQuote({ | |
direction: 'from-ripple' | |
ripple: { | |
source: { | |
address: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk' | |
} | |
}, | |
external: { | |
destination: { | |
account: { | |
name: '[email protected]' | |
}, | |
amount: { | |
currency: 'BTC', | |
value : 15.2 | |
} | |
} | |
} | |
}) | |
bridgeQuote.fetch().then(function(quote) { | |
console.log(quote) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment