PageSourceSearch

https://www.newbalance.co.id/static/version1790176090/frontend/New…/id_ID/PayMongo_Payments/js/paymongo.js

js newbalance.co.id collected 2026-10-07 08:50:16 UTC 1,599 bytes, 62 lines download raw bytes

1// Copyright © PayMongo
2//
3// @package    PayMongo_Payments
4// @version    1.0.0
5
6// Global Namespace
7var paymongo = {
8  api: null,
9  isInitialized: false,
10  createPaymentMethod: function (details) {
11    return paymongo.api.post("/payment_methods", details);
12  },
13  processErrors: function (data) {
14    const self = this;
15    const errors = [];
16    data.errors.forEach(function (error) {
17      errors.push(self.parseError(error));
18    });
19
20    return errors;
21  },
22  parseError: function (error) {
23    var message = 'Something went wrong. Please contact the merchant or website administrator.'
24
25    if (typeof error === 'object' && Object.keys(error).length > 0) {
26        var code = error.code;
27        var detail = error.detail;
28
29        switch (code) {
30            case 'parameter_format_invalid':
31            case 'parameter_invalid': {
32              message = this.parseDetail(detail);
33              break;
34            }
35        }
36    }
37
38    return { message };
39  },
40  parseDetail: function (detail) {
41    const detailKeyMap = {
42      'details.card_number': 'Credit card number',
43      'details.exp_year': 'Expiry year'
44    }
45
46    return Object.keys(detailKeyMap).reduce(function (message, key) {
47      if (!detail.includes(key)) return message;
48
49      return detail.replace(key, detailKeyMap[key])
50    }, 'There were invalid data in your submission');
51  }
52};
53
54var initPayMongo = function (apiKey, axios) {
55  paymongo.api = axios.create({
56    baseURL: "https://api.paymongo.com/v1/",
57    headers: {
58      Authorization: "Basic " + btoa(apiKey),
59    },
60  });
61  paymongo.isInitialized = true;
62};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.