Exemplo n.º 1
0
		public TransactionRegistration(string vendorTxCode, ShoppingBasket basket, string notificationUrl,
							Address billingAddress, Address deliveryAddress, string customerEmail,
							string vendorName, PaymentFormProfile paymentFormProfile, string currencyCode, 
							MerchantAccountType accountType, TxType txType) {
			VendorTxCode = vendorTxCode;
			NotificationURL = notificationUrl;
			this.basket = basket;
			this.billingAddress = billingAddress;
			this.deliveryAddress = deliveryAddress;
			customerEMail = customerEmail;
			this.vendorName = vendorName;
			switch (paymentFormProfile) {
				case PaymentFormProfile.Low:
					profile = LowProfileFormMode;
					break;
				default:
					profile = NormalFormMode;
					break;
			}
			switch (accountType)
			{
				case MerchantAccountType.MailOrder:
					this.accountType=AccountTypeMailOrder;
					break;
				default:
					this.accountType = AccountTypeEcommerce;
					break;
			}
			this.currency = currencyCode;
			this.txType = txType.ToString().ToUpperInvariant();
		}
Exemplo n.º 2
0
        public TransactionRegistrationResponse Send(RequestContext context, string vendorTxCode, ShoppingBasket basket,
            Address billingAddress, Address deliveryAddress, string customerEmail, PaymentFormProfile paymentFormProfile = PaymentFormProfile.Normal, string currencyCode="GBP")
        {
            string sagePayUrl = configuration.RegistrationUrl;
            string notificationUrl = urlResolver.BuildNotificationUrl(context);

            var registration = new TransactionRegistration(
                vendorTxCode, basket, notificationUrl,
                billingAddress, deliveryAddress, customerEmail,
                configuration.VendorName,
                paymentFormProfile, currencyCode);

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

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

            var deserializer = new ResponseSerializer();
            return deserializer.Deserialize<TransactionRegistrationResponse>(response);
        }
Exemplo n.º 3
0
        public TransactionRegistration(string vendorTxCode, ShoppingBasket basket, string notificationUrl,
                                       Address billingAddress, Address deliveryAddress, string customerEmail,
                                       string vendorName, PaymentFormProfile paymentFormProfile, string currencyCode)
        {
            VendorTxCode         = vendorTxCode;
            NotificationURL      = notificationUrl;
            this.basket          = basket;
            this.billingAddress  = billingAddress;
            this.deliveryAddress = deliveryAddress;
            customerEMail        = customerEmail;
            this.vendorName      = vendorName;
            switch (paymentFormProfile)
            {
            case PaymentFormProfile.Low:
                profile = LowProfileFormMode;
                break;

            default:
                profile = NormalFormMode;
                break;
            }
            this.currency = currencyCode;
        }
Exemplo n.º 4
0
        public TransactionRegistrationResponse Send(RequestContext context, string vendorTxCode, ShoppingBasket basket,
                                                    Address billingAddress, Address deliveryAddress, string customerEmail, PaymentFormProfile paymentFormProfile = PaymentFormProfile.Normal, string currencyCode = "GBP")
        {
            string sagePayUrl      = configuration.RegistrationUrl;
            string notificationUrl = urlResolver.BuildNotificationUrl(context);

            var registration = new TransactionRegistration(
                vendorTxCode, basket, notificationUrl,
                billingAddress, deliveryAddress, customerEmail,
                configuration.VendorName,
                paymentFormProfile, currencyCode);

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

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

            var deserializer = new ResponseSerializer();

            return(deserializer.Deserialize <TransactionRegistrationResponse>(response));
        }