public async Task ConfirmPayment(PaymentStatus status) { var form = new Dictionary <string, object> { { "p24_merchant_id", status.p24_merchant_id }, { "p24_pos_id", status.p24_pos_id }, { "p24_session_id", status.p24_session_id }, { "p24_amount", status.p24_amount }, { "p24_currency", status.p24_currency }, { "p24_order_id", status.p24_order_id }, { "p24_sign", status.p24_sign } }; var response = await _payments24Client.Pay(form); var message = $"{response.ResponseMessage.StatusCode} ({response.StringContent})"; LogResponse(message); if (!response.ResponseMessage.IsSuccessStatusCode) { return; } var license = await _licensesRepository.GetLicense(int.Parse(status.p24_session_id)); license.Paid = true; license.PaymentMethod = status.p24_method; license.OrderId = status.p24_order_id.ToString(); await _licensesRepository.Save(license); }
public async Task <FighterLicenseResponseModel> CreateFighterLicense(int licenseTypeId, string fighterId) { var licenseType = await _licenseTypesRepository.Get(licenseTypeId); var license = new FighterLicense { LicenseTypeId = licenseType.Id, Currency = licenseType.Currency, FighterId = fighterId, From = DateTime.Today, To = DateTime.Today.AddDays(licenseType.Duration), Kind = licenseType.Kind, Price = licenseType.Price, Paid = false }; await _licensesRepository.Save(license); return(_mapper.Map <FighterLicenseResponseModel>(license)); }