public PaymentResponseBo Process(PaymentBo payment)
        {
            var membershipServiceResponse = membershipService.Upgrade(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.UpgradeNotify(payment.Customer);

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

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

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

            return(new PaymentResponseBo
            {
                PaymentResponseType = PaymentResponseType.Success
            });
        }
Esempio n. 2
0
        public PaymentResponse HandleUpgradeMembershipPayment(Payment payment)
        {
            var membershipServiceResponse = membershipService.Upgrade(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.UpgradeNotify(payment.Customer);

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

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

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

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