public async Task UpdatePaymentStatus(string paymentId) { var localPayment = await FetchPaymentByMollieId(paymentId); var molliePayment = await FetchMolliePayment(paymentId); try { var paymentStatus = molliePayment.Status ?? throw new NullReferenceException(); localPayment.Status = MollieConverter.FromMolliePaymentStatus(paymentStatus); await UpdatePayment(localPayment); } catch (Exception e) { _logger.LogError("Error while updating the payment status: " + e.Message); } }
public async Task <PaymentResponse> CreateMolliePayment(decimal amount, string description, PaymentMethod method) { var paymentMethod = MollieConverter.ToMolliePaymentMethod(method); var amountFormatted = String.Format("{0:0.00}", amount); var paymentRequest = new PaymentRequest() { Amount = new Amount(Currency.EUR, amountFormatted), Description = description, RedirectUrl = this.MOLLIE_REDIRECT_URL, WebhookUrl = this.MOLLIE_WEBHOOK_URL, Method = paymentMethod }; return(await _client.CreatePaymentAsync(paymentRequest)); }