Created
August 11, 2019 10:10
-
-
Save andrew-grischenko/f2ad57a51b99126a6468b865478654ac to your computer and use it in GitHub Desktop.
This file contains 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
module.exports = function (context, req) { | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
var request = require('request'); | |
var transaction = context.req.query.transaction; | |
request( | |
{ | |
url : 'https://api.sandbox.ewaypayments.com/Transaction/' + transaction, | |
auth: { | |
user: "<your eWAY username goes here>", // or use process.env["EWAY_APP_KEY"], | |
password: "<your eWAY password goes here>"//or use process.env["EWAY_PASSWORD"] | |
} | |
}, function (error, response, body) { | |
if (error) { | |
context.log(error); | |
} | |
if (!error && response.statusCode == 200) { | |
context.log(body); | |
context.res = { status: 200, body: body }; | |
} | |
context.done(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment