Exemplo n.º 1
0
        public PaymentResponseBo Process(PaymentBo payment)
        {
            var membershipServiceResponse = membershipService.Activate(payment.Customer);

            if (membershipServiceResponse.MembershipServiceResponseType == MembershipServiceResponseType.Failure)
            {
                Logger.Instance.Log(LoggerType.Error, membershipServiceResponse.ErrorMessage);

                return(new PaymentResponseBo
                {
                    ErrorMessage = membershipServiceResponse.ErrorMessage,
                    PaymentResponseType = PaymentResponseType.Failure
                });
            }

            var notificationResponse = notificatiionMembershipService.ActivateNotify(payment.Customer);

            if (notificationResponse.MembershipServiceResponseType == MembershipServiceResponseType.Failure)
            {
                Logger.Instance.Log(LoggerType.Error, membershipServiceResponse.ErrorMessage);

                return(new PaymentResponseBo
                {
                    ErrorMessage = membershipServiceResponse.ErrorMessage,
                    PaymentResponseType = PaymentResponseType.Failure
                });
            }

            Logger.Instance.Log(LoggerType.Information, this.localizedMessageProvider.GetMembershipPaymentSucessfulMessage);

            return(new PaymentResponseBo
            {
                PaymentResponseType = PaymentResponseType.Success
            });
        }
        public PaymentResponse HandleMembershipPayment(Payment payment)
        {
            var membershipServiceResponse = membershipService.Activate(payment.Customer);

            if (membershipServiceResponse.MembershipServiceResponseType == MembershipServiceResponseType.Failure)
            {
                Logger.Instance.Log(LoggerType.Error, membershipServiceResponse.ErrorMessage);

                return(new PaymentResponse
                {
                    ErrorMessage = membershipServiceResponse.ErrorMessage,
                    PaymentResponseType = PaymentResponseType.Failure
                });
            }

            var notificationResponse = notificatiionMembershipService.ActivateNotify(payment.Customer);

            if (notificationResponse.MembershipServiceResponseType == MembershipServiceResponseType.Failure)
            {
                Logger.Instance.Log(LoggerType.Error, membershipServiceResponse.ErrorMessage);

                return(new PaymentResponse
                {
                    ErrorMessage = membershipServiceResponse.ErrorMessage,
                    PaymentResponseType = PaymentResponseType.Failure
                });
            }

            Logger.Instance.Log(LoggerType.Information, Resources.MembershipPaymentSucessful);

            return(new PaymentResponse
            {
                PaymentResponseType = PaymentResponseType.Success
            });
        }