public async Task <ChapterAdminPaymentSettingsApiResponse> UpdatePaymentSettings(Guid id, [FromForm] UpdateChapterPaymentSettingsApiRequest request) { UpdateChapterPaymentSettings update = _mapper.Map <UpdateChapterPaymentSettings>(request); ChapterPaymentSettings settings = await _chapterAdminService.UpdateChapterPaymentSettings(GetMemberId(), id, update); return(_mapper.Map <ChapterAdminPaymentSettingsApiResponse>(settings)); }
public async Task UpdateChapterPaymentSettings(ChapterPaymentSettings settings) { await Context .Update <ChapterPaymentSettings>() .Set(x => x.ApiPublicKey, settings.ApiPublicKey) .Set(x => x.ApiSecretKey, settings.ApiSecretKey) .Where(x => x.ChapterId).EqualTo(settings.ChapterId) .ExecuteAsync(); }
public async Task <ChapterPaymentSettings> UpdateChapterPaymentSettings(Guid currentMemberId, Guid chapterId, UpdateChapterPaymentSettings settings) { await AssertMemberIsChapterAdmin(currentMemberId, chapterId); ChapterPaymentSettings existing = await _chapterRepository.GetChapterPaymentSettings(chapterId); ChapterPaymentSettings update = new ChapterPaymentSettings(chapterId, settings.ApiPublicKey, settings.ApiSecretKey, existing.Provider); await _chapterRepository.UpdateChapterPaymentSettings(update); return(update); }
public async Task <Guid> MakePayment(Member member, double amount, string cardToken, string reference) { ChapterPaymentSettings paymentSettings = await _chapterRepository.GetChapterPaymentSettings(member.ChapterId); Chapter chapter = await _chapterRepository.GetChapter(member.ChapterId); Country country = await _countryRepository.GetCountry(chapter.CountryId); await _paymentProvider.MakePayment(paymentSettings.ApiSecretKey, country.CurrencyCode, amount, cardToken, reference, $"{member.FirstName} {member.LastName}"); Payment payment = new Payment(Guid.Empty, member.Id, DateTime.UtcNow, country.CurrencyCode, amount, reference); return(await _paymentRepository.CreatePayment(payment)); }
public async Task <ChapterAdminPaymentSettingsApiResponse> PaymentSettings(Guid id) { ChapterPaymentSettings settings = await _chapterAdminService.GetChapterPaymentSettings(GetMemberId(), id); return(_mapper.Map <ChapterAdminPaymentSettingsApiResponse>(settings)); }