Issues (4)

index.js (4 issues)

Labels
Severity
1
2
const axios = require('axios');
3
4
async function mpesaPayment(customer,products,amount,callback_details) {
5
6
    headers = {
0 ignored issues
show
The variable headers seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.headers.
Loading history...
7
        "domain": process.env.CHPTER_CLIENT_DOMAIN,
8
        "Authorization":"Token "+ process.env.CHPTER_TOKEN
9
    };
10
11
    data =  {
0 ignored issues
show
The variable data seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.data.
Loading history...
12
        "customer_details" : customer,
13
        "products" : products,
14
        "amount" : amount,
15
        "callback_details" : callback_details
16
    };
17
18
    let res = await axios.post("https://chpter.co/api/payment/payment-initiate-callback/", data, { headers:  headers});
19
20
    return res.data;
21
}
22
 
23
24
async function cardPayment(customer,products,amount, card_details, callback_details) {
25
    headers = {
0 ignored issues
show
The variable headers seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.headers.
Loading history...
26
        "domain": process.env.CHPTER_CLIENT_DOMAIN,
27
        "Authorization":"Token "+ process.env.CHPTER_TOKEN
28
    };
29
30
    data =  {
0 ignored issues
show
The variable data seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.data.
Loading history...
31
        "customer_details" : customer,
32
        "products" : products,
33
        "amount" : amount,
34
        "card_details" : card_details,
35
        "callback_details" : callback_details
36
    };
37
    let res = await axios.post("https://chpter.co/api/payment/payment-initiate-callback/", data, { headers:  headers});
38
39
    return res.data;
40
  };
41
 
42
  function mobilePayout() {
43
    return "mobilePayout";
44
  };
45
46
  function domesticBanksPayout() {
47
  
48
    return "domesticBanksPayout";
49
  };
50
51
  module.exports = {
52
    mpesaPayment,
53
    cardPayment,
54
    mobilePayout,
55
    domesticBanksPayout,
56
57
 }