예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
		public static async Task<List<Operation>> Run(HttpClient client, string bankAccountId, Parameters parameters)
		{
			return await RepeatedCall.ActionAsync(async () =>
			{
				OperationHistoryRequest request = new OperationHistoryRequest(client);
				return await request.Run(bankAccountId, parameters);
			}, 5, 1000);
		}