Compare commits

...

2 Commits

Author SHA1 Message Date
zelda 9ed2a16b1a Merge pull request 'Deploy to statging' (#90) from main into staging
Reviewed-on: #90
2025-08-22 11:28:22 +10:00
Admin aeebe9a43d fix grays bid 2025-08-22 08:27:10 +07:00
1 changed files with 30 additions and 0 deletions

View File

@ -440,6 +440,17 @@ export class GraysProductBid extends ProductBid {
return;
}
const bids = await this.getCurrentHistories();
const bidedData = this.bidedData(bids);
console.log({ bidedData });
if (bidedData && bidedData.Price >= this.max_price + this.plus_price) {
console.log(`[${this.id}] Bidded with ${bidedData.Price}`);
return;
}
console.log(
"-------------------------------------BIDING---------------------------------------"
);
@ -457,6 +468,25 @@ export class GraysProductBid extends ProductBid {
}
}
async getCurrentHistories() {
const { data } = await axios({
url: `https://www.grays.com/api/LotInfo/GetBiddingHistory?lotId=${this.lot_id}`,
});
const bids = data?.Bids || [];
return bids;
}
bidedData(bids) {
// A.V - Lidcombe NSW
const data = bids.find(
(bid) =>
`${bid?.UserInitials} - ${bid.UserShortAddress}` == "A.V - Lidcombe NSW"
);
return data;
}
getBidedData() {
return global[`BIDED_DATA_${this.web_bid?.origin_url}`];
}