@yosle/tropipayjs 0.1.24 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +909 -910
- package/package.json +1 -1
- package/src/api/TropipayAPI.ts +20 -19
package/package.json
CHANGED
package/src/api/TropipayAPI.ts
CHANGED
|
@@ -87,10 +87,11 @@ export class Tropipay {
|
|
|
87
87
|
|
|
88
88
|
// Create a separate instance for login requests
|
|
89
89
|
this.loginRequest = axios.create({
|
|
90
|
-
baseURL: tpp_env,
|
|
90
|
+
baseURL: config.customTropipayUrl || tpp_env,
|
|
91
91
|
headers: {
|
|
92
92
|
"Content-Type": "application/json",
|
|
93
93
|
Accept: "application/json",
|
|
94
|
+
Authorization: `Bearer ${Tropipay.accessToken}`,
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
97
|
|
|
@@ -131,24 +132,24 @@ export class Tropipay {
|
|
|
131
132
|
|
|
132
133
|
public async login() {
|
|
133
134
|
try {
|
|
134
|
-
if (Tropipay.refreshToken) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
135
|
+
// if (Tropipay.refreshToken) {
|
|
136
|
+
// const { data } = await this.loginRequest.post<LoginResponse>(
|
|
137
|
+
// "/api/v2/access/token",
|
|
138
|
+
// {
|
|
139
|
+
// client_id: this.clientId,
|
|
140
|
+
// client_secret: this.clientSecret,
|
|
141
|
+
// grant_type: "refresh_token",
|
|
142
|
+
// refresh_token: Tropipay.refreshToken,
|
|
143
|
+
// },
|
|
144
|
+
// {
|
|
145
|
+
// headers: {
|
|
146
|
+
// "Content-Type": "application/json",
|
|
147
|
+
// Accept: "application/json",
|
|
148
|
+
// },
|
|
149
|
+
// }
|
|
150
|
+
// );
|
|
151
|
+
// return data;
|
|
152
|
+
// }
|
|
152
153
|
|
|
153
154
|
// normal credetials login
|
|
154
155
|
const { data } = await this.loginRequest.post<LoginResponse>(
|