response
This commit is contained in:
@@ -16,11 +16,15 @@ interface WebSessionResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface CheckFastcheckResponse {
|
interface CheckFastcheckResponse {
|
||||||
fastcheck: string;
|
id: string;
|
||||||
amount?: number; // not in doc but server may include it
|
code: string;
|
||||||
expiration: string;
|
owneID: string;
|
||||||
Status: boolean;
|
amount: number;
|
||||||
message?: string;
|
currency: string;
|
||||||
|
createdAt: string;
|
||||||
|
creattransactionID: string;
|
||||||
|
firedAT: string;
|
||||||
|
firetransactionID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -241,20 +245,17 @@ export class FastcheckPage {
|
|||||||
this.fastcheckAmount.set(null);
|
this.fastcheckAmount.set(null);
|
||||||
this.codeEnabled.set(false);
|
this.codeEnabled.set(false);
|
||||||
|
|
||||||
// API doc: GET /fastcheck with fastcheck as query param
|
// API doc: GET /fastcheck/<id>
|
||||||
this.http
|
this.http
|
||||||
.get<CheckFastcheckResponse>(`${FASTCHECK_API}/fastcheck`, {
|
.get<CheckFastcheckResponse>(`${FASTCHECK_API}/fastcheck/${number}`)
|
||||||
params: { fastcheck: number }
|
|
||||||
})
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
this.amountLoading.set(false);
|
this.amountLoading.set(false);
|
||||||
if (res?.Status) {
|
if (res?.id) {
|
||||||
// amount may or may not be in response — show if present
|
|
||||||
this.fastcheckAmount.set(typeof res.amount === 'number' ? res.amount : null);
|
this.fastcheckAmount.set(typeof res.amount === 'number' ? res.amount : null);
|
||||||
this.codeEnabled.set(true);
|
this.codeEnabled.set(true);
|
||||||
} else {
|
} else {
|
||||||
this.error.set(res?.message ?? this.t('errors.not_found'));
|
this.error.set(this.t('errors.not_found'));
|
||||||
this.lastLookedUpNumber = '';
|
this.lastLookedUpNumber = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user