Exemplo n.º 1
0
        private PaymentToBookingDto GetPaymentToBookingParam(RefundOriginalPaymentDto parameter,
                                                             decimal amountToRefundPending,
                                                             PaymentDto validPayment)
        {
            var paymentMethodType = validPayment.PaymentMethodType;

            var paymentToBookingParam = new PaymentToBookingDto()
            {
                Signature         = parameter.Signature,
                BalanceDue        = -amountToRefundPending,
                CurrencyCode      = validPayment.CurrencyCode,
                AccountNumber     = validPayment.AccountNumber,
                IsCreditFile      = false,
                PaymentMethodType = paymentMethodType,
                PaymentMethodCode = validPayment.PaymentMethodCode,
                PaymentText       = CommentConst,
                ExpirationDate    = validPayment.Expiration,
                PaymentFields     = validPayment.PaymentFieldsList,
                ParentPaymentId   = validPayment.PaymentId,
                AccountNumberId   = validPayment.AccountNumberId
            };

            if (paymentMethodType == PaymentMethodType.ExternalAccount || paymentMethodType == PaymentMethodType.PrePaid)
            {
                paymentToBookingParam.AccountNumberId = validPayment.AccountNumberId;
                paymentToBookingParam.ExpirationDate  = validPayment.Expiration;
            }

            return(paymentToBookingParam);
        }
Exemplo n.º 2
0
 public AddPaymentResponseDto AddPayment(PaymentToBookingDto paymentToBookingParam)
 {
     try
     {
         //ToDo
         return(new AddPaymentResponseDto());
     }
     catch (Exception ex)
     {
         var errorMessage =
             $"Error in: {GetType().FullName}, method: AddPayment, exception: AddPaymentException, message: {ex.Message}.";
         throw new AddPaymentException(errorMessage);
     }
 }
Exemplo n.º 3
0
        private PaymentDto AddPayment(PaymentToBookingDto paymentToBookingParam)
        {
            try
            {
                var addPaymentToBookingResponse = _paymentService.AddPayment(paymentToBookingParam);

                if (addPaymentToBookingResponse?.ValidationPayment != null &&
                    addPaymentToBookingResponse.ValidationPayment.PaymentValidationErrors.Any())
                {
                    throw new Exception(addPaymentToBookingResponse.ValidationPayment.PaymentValidationErrors.First().ErrorDescription);
                }

                return(addPaymentToBookingResponse.ValidationPayment.Payment);
            }
            catch (Exception ex)
            {
                var errorMessage = $@"Error in: {GetType().FullName}, method : AddPayment, paymentMethodType: {paymentToBookingParam.PaymentMethodType}, innerExceptionType: {ex.GetType()}, innerExceptionMessage: {ex.Message}";
                throw new AddPaymentException(errorMessage, ex);
            }
        }