Guest User

Untitled

a guest
Nov 1st, 2017
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. const functions = require('firebase-functions');
  2. const cors = require('cors');
  3. var requestz = require('request');
  4.  
  5. var makeRequest = function makeRequest(request, response){
  6. var formData = {
  7. bulkFileValue: "WyI5MjMyMzE0OTQ3NTYixxxxTciLCI5MjMwNTIyNzM1NzUiLCI5MjMyMTE0OTQ3NTkiLCI5MjMyMTQyODYzNzQiLCI5MjMyMTE0OTQ3Nxxxx0OTQ3NjIiLxxE0OTQ3NjMiLCI5MjMyMTE0OTQ3NjQiLCI5MjMxxQ3NjUiLCI5MjMyMTE0OTQ3NjYiXQ==",
  8. applicationVersion: "1.0",
  9. username: 'axxxz@fxxxxa.pk', password: 'Wxxxxedxxx3'
  10.  
  11. }
  12. var options = {
  13. url: 'http://newxxxxxapi.fxxxxca.web.pk/UploxxxxxkEx',
  14. headers: {
  15. 'Content-Type':'application/x-www-form-urlencoded',
  16. 'appKey':'dNExxxxxARypxxxxnLG',
  17. 'appId':'2xxxxx7'
  18. },
  19. formData: formData
  20. };
  21.  
  22. function callback(error, resp, body) {
  23. if (!error && resp.statusCode == 200) {
  24. var info = JSON.parse(body);
  25. console.log(info);
  26. response.send(info);
  27. }
  28. }
  29.  
  30. requestz.post(options, callback);
  31.  
  32. }
  33.  
  34.  
  35.  
  36. exports.processPayroll = functions.https.onRequest((request, response) => {
  37. var corsFn = cors();
  38. corsFn(request, response, function() {
  39. makeRequest(request, response);
  40. })
  41.  
  42. });
Add Comment
Please, Sign In to add comment