• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paypay / paypayopa-sdk-node / 3889352965

pending completion
3889352965

push

github

GitHub
Merge pull request #654 from paypay/dependabot/npm_and_yarn/json5-2.2.3

41 of 45 branches covered (91.11%)

Branch coverage included in aggregate %.

177 of 188 relevant lines covered (94.15%)

20.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/lib/conf.ts
1
import * as defaultPathConfig from "./conf.path.json";
25✔
2
import { HOST_PATH } from "./environments";
25✔
3

4
export interface Config {
5
  PORT_NUMBER?: number;
6
  API_PAYMENT: {};
7
  API_WALLET: {};
8
  API_DIRECT_DEBIT: {};
9
  API_APP_INVOKE: {};
10
  API_WEB_CASHIER: {};
11
  API_ACCOUNT_LINK: {};
12
  API_SUBSCRIPTION: {};
13
}
14

15
export class Conf {
25✔
16
  private readonly configLookup: any;
17
  private portNumber: number;
18
  private hostName: string;
19

20
  constructor({ hostName, portNumber }: { hostName: string, portNumber?: number }) {
21
    this.configLookup = JSON.parse(JSON.stringify(defaultPathConfig));
65✔
22
    this.hostName = hostName;
65✔
23
    this.portNumber = portNumber || 443;
65✔
24
  }
25

26
  static forEnvironment(env: 'PROD' | 'STAGING' | 'PERF_MODE'): Conf {
27
    const hostName = HOST_PATH[env];
65✔
28
    if (!hostName) {
65!
29
      throw new Error('no built-in environment named `' + env + '`');
×
30
    }
31
    return new Conf({ hostName });
65✔
32
  }
33

34
  getHttpsMethod(nameApi: string, nameMethod: string): string {
35
    return this.configLookup[nameApi][nameMethod].METHOD;
34✔
36
  }
37

38
  getHttpsPath(nameApi: string, nameMethod: string): string {
39
    return this.configLookup[nameApi][nameMethod].PATH;
34✔
40
  }
41

42
  getApiKey(nameApi: string, nameMethod: string): string | undefined {
43
    return this.configLookup[nameApi][nameMethod].API_NAME;
34✔
44
  }
45

46
  getHostname() {
47
    return this.hostName;
34✔
48
  }
49

50
  getPortNumber() {
51
    return this.portNumber;
34✔
52
  }
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc