UNPKG

@owstack/ows-wallet-servlet-coinbase

Version:

An OWS Wallet servlet plugin for Coinbase.

37 lines (26 loc) 777 B
'use strict'; angular.module('owsWalletPlugin.apiHandlers').service('getExchangeRates', function(coinbaseService) { var root = {}; root.respond = function(message, callback) { // Request parameters. var currency = message.request.params.currency; coinbaseService.getExchangeRates(currency).then(function(response) { message.response = { statusCode: 200, statusText: 'OK', data: response }; return callback(message); }).catch(function(error) { message.response = { statusCode: error.statusCode || 500, statusText: error.statusText || 'UNEXPECTED_ERROR', data: { message: error.message } }; return callback(message); }); }; return root; });