Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. var express = require('express');
  2. var router = express.Router();
  3. var khipu = require('fi-khipu');
  4.  
  5. khipu.configure(CODE, '');
  6. khipu.config.sslVerification = false;
  7.  
  8.  
  9. /* GET home page. */
  10. router.get('/', function (req, res, next) {
  11. khipu.listBanks(function callback(err, banks) {
  12. if (err) {
  13. throw err;
  14. }
  15.  
  16. res.render('index', { title: 'Express', banks: banks });
  17. });
  18. });
  19.  
  20. router.post('/payment', function (req, res) {
  21. var payment = {
  22. subject: 'Payment test',
  23. amount: 10
  24. //...
  25. };
  26.  
  27. khipu.createPayment(payment, function callback(err, payment) {
  28. if (err) {
  29. throw err;
  30. }
  31.  
  32. console.log(payment)
  33. });
  34. });
  35.  
  36. router.get('/payment', function (req, res) {
  37. khipu.getPaymentById('lnb3o2kexf8o', function (err, payment) {
  38. if (err) {
  39. throw err;
  40. }
  41.  
  42. console.log(payment);
  43. });
  44. });
  45.  
  46. router.get('/cancel_pay', function (req, res) {
  47. var paymentId = 'lnb3o2kexf8o';
  48.  
  49. khipu.deletePayment(paymentId, function (err, payment) {
  50. if (err) {
  51. throw err;
  52. }
  53.  
  54. console.log(payment)
  55. });
  56. });
  57.  
  58. module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement