private async Task StoreThisDayPayments(string from, bool untilFirstFoundRecord) { int offset = 0; int records = this._config.FetchSize; int increment = records / 2; OperationHistoryRequest.Parameters p = new OperationHistoryRequest.Parameters { category = "Debet", from = from, skip = offset, records = records }; while (true) { List <OperationHistoryRequest.Operation> list = await OperationHistoryRequest.Run(this._client, this._config.AccountId, p); if (list.Count == 0) { return; } bool firstRecordAlreadyInDb = await this.SavePaymentRecords(list); if (untilFirstFoundRecord && firstRecordAlreadyInDb) { return; } if (list.Count < records) { return; } p.skip += increment; } }
private async Task StorePayments(string from, string till) { int offset = 0; int records = this._config.FetchSize; int increment = records; OperationHistoryRequest.Parameters p = new OperationHistoryRequest.Parameters { category = "Debet", from = from, till = till, skip = offset, records = records }; while (true) { List <OperationHistoryRequest.Operation> list = await OperationHistoryRequest.Run(this._client, this._config.AccountId, p); if (list.Count == 0) { return; } await this.SavePaymentRecords(list); if (list.Count < records) { return; } p.skip += increment; } }