Beispiel #1
0
            async Task <Result <PaymentResponse> > StorePaymentResults(CreditCardPaymentResult paymentResult)
            {
                var card = request.IsSaveCardNeeded
                    ? await _context.CreditCards.SingleOrDefaultAsync(c => c.Token == request.Token)
                    : null;

                var payment = await CreatePayment(ipAddress, servicePrice, card?.Id, paymentResult);

                var(_, isFailure, error) = await paymentCallbackService.ProcessPaymentChanges(payment);

                return(isFailure
                    ? Result.Failure <PaymentResponse>(error)
                    : Result.Success(paymentResult.ToPaymentResponse()));
            }
            async Task <Result <PaymentResponse> > StorePaymentResults(CreditCardPaymentResult paymentResult)
            {
                var card = request.IsSaveCardNeeded
                    ? await _context.CreditCards.SingleOrDefaultAsync(c => c.Token == request.Token)
                    : null;

                var payment = await CreatePayment(ipAddress, servicePrice, card?.Id, paymentResult);

                var(_, isFailure, error) = await paymentsService.ProcessPaymentChanges(payment)
                                           .Bind(() => _bookingRecordsManager.SetPaymentMethod(request.ReferenceCode, PaymentMethods.CreditCard));

                return(isFailure
                    ? Result.Failure <PaymentResponse>(error)
                    : Result.Success(paymentResult.ToPaymentResponse()));
            }