예제 #1
0
        public TransactionRegistrationResponse Register(CartModel cartModel)
        {
            string sagePayUrl = _sagePaySettings.RegistrationUrl;

            var registration = _transactionRegistrationBuilder.BuildRegistration(cartModel);

            var serializer = new HttpPostSerializer();
            var postData = serializer.Serialize(registration);

            var response = _httpRequestSender.SendRequest(sagePayUrl, postData);

            var deserializer = new ResponseSerializer();
            var registrationResponse = deserializer.Deserialize<TransactionRegistrationResponse>(response);
            if (registrationResponse.StatusDetail.StartsWith("4042"))
                registrationResponse.Status = ResponseType.Invalid;
            registrationResponse.VendorTxCode = registration.VendorTxCode;
            registrationResponse.CartTotal = cartModel.TotalToPay;
            return registrationResponse;
        }
예제 #2
0
        public TransactionRegistrationResponse Register(CartModel cartModel)
        {
            string sagePayUrl = _sagePaySettings.RegistrationUrl;

            var registration = _transactionRegistrationBuilder.BuildRegistration(cartModel);

            var serializer = new HttpPostSerializer();
            var postData   = serializer.Serialize(registration);

            var response = _httpRequestSender.SendRequest(sagePayUrl, postData);

            var deserializer         = new ResponseSerializer();
            var registrationResponse = deserializer.Deserialize <TransactionRegistrationResponse>(response);

            if (registrationResponse.StatusDetail.StartsWith("4042"))
            {
                registrationResponse.Status = ResponseType.Invalid;
            }
            registrationResponse.VendorTxCode = registration.VendorTxCode;
            registrationResponse.CartTotal    = cartModel.TotalToPay;
            return(registrationResponse);
        }