@yosle/tropipayjs 0.1.25 → 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 +19 -14
- package/package.json +1 -1
- package/src/api/TropipayAPI.ts +19 -18
package/index.js
CHANGED
|
@@ -534,6 +534,7 @@ class Tropipay {
|
|
|
534
534
|
headers: {
|
|
535
535
|
"Content-Type": "application/json",
|
|
536
536
|
Accept: "application/json",
|
|
537
|
+
Authorization: `Bearer ${Tropipay.accessToken}`,
|
|
537
538
|
},
|
|
538
539
|
});
|
|
539
540
|
// Add request interceptor for Token expired
|
|
@@ -562,20 +563,24 @@ class Tropipay {
|
|
|
562
563
|
}
|
|
563
564
|
async login() {
|
|
564
565
|
try {
|
|
565
|
-
if (Tropipay.refreshToken) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
566
|
+
// if (Tropipay.refreshToken) {
|
|
567
|
+
// const { data } = await this.loginRequest.post<LoginResponse>(
|
|
568
|
+
// "/api/v2/access/token",
|
|
569
|
+
// {
|
|
570
|
+
// client_id: this.clientId,
|
|
571
|
+
// client_secret: this.clientSecret,
|
|
572
|
+
// grant_type: "refresh_token",
|
|
573
|
+
// refresh_token: Tropipay.refreshToken,
|
|
574
|
+
// },
|
|
575
|
+
// {
|
|
576
|
+
// headers: {
|
|
577
|
+
// "Content-Type": "application/json",
|
|
578
|
+
// Accept: "application/json",
|
|
579
|
+
// },
|
|
580
|
+
// }
|
|
581
|
+
// );
|
|
582
|
+
// return data;
|
|
583
|
+
// }
|
|
579
584
|
// normal credetials login
|
|
580
585
|
const { data } = await this.loginRequest.post("/api/v2/access/token", {
|
|
581
586
|
client_id: this.clientId,
|
package/package.json
CHANGED
package/src/api/TropipayAPI.ts
CHANGED
|
@@ -91,6 +91,7 @@ export class Tropipay {
|
|
|
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>(
|