コード例 #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();
		}
コード例 #2
0
        public static string EnumToString(this MerchantAccountType type)
        {
            switch (type)
            {
            case MerchantAccountType.Business: return("BUSINESS");

            case MerchantAccountType.Location: return("LOCATION");

            default: throw new ArgumentOutOfRangeException();
            }
        }
コード例 #3
0
 public void SetMerchantAccountType(string provider)
 {
     if (provider.Equals(PaymentProviderConstants.Stripe, StringComparison.OrdinalIgnoreCase))
     {
         MerchantAccountType = MerchantAccountType.Stripe;
     }
     else if (provider.Equals(PaymentProviderConstants.FirstData, StringComparison.OrdinalIgnoreCase))
     {
         MerchantAccountType = MerchantAccountType.FirstData;
     }
 }
コード例 #4
0
		public TransactionRegistrationResponse Send(RequestContext context, string vendorTxCode, ShoppingBasket basket,
								Address billingAddress, Address deliveryAddress, string customerEmail, PaymentFormProfile paymentFormProfile = PaymentFormProfile.Normal, string currencyCode="GBP",
								MerchantAccountType accountType=MerchantAccountType.Ecommerce, TxType txType=TxType.Payment) {
			string sagePayUrl = configuration.RegistrationUrl;
			string notificationUrl = urlResolver.BuildNotificationUrl(context);

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

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

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

			var deserializer = new ResponseSerializer();
			return deserializer.Deserialize<TransactionRegistrationResponse>(response);
		}
コード例 #5
0
        public TransactionRegistrationResponse Send(RequestContext context, string vendorTxCode, ShoppingBasket basket,
                                                    Address billingAddress, Address deliveryAddress, string customerEmail, PaymentFormProfile paymentFormProfile = PaymentFormProfile.Normal, string currencyCode = "GBP",
                                                    MerchantAccountType accountType = MerchantAccountType.Ecommerce, TxType txType = TxType.Payment)
        {
            string sagePayUrl      = configuration.RegistrationUrl;
            string notificationUrl = urlResolver.BuildNotificationUrl(context);

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

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

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

            var deserializer = new ResponseSerializer();

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