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(); }
public static string EnumToString(this MerchantAccountType type) { switch (type) { case MerchantAccountType.Business: return("BUSINESS"); case MerchantAccountType.Location: return("LOCATION"); default: throw new ArgumentOutOfRangeException(); } }
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; } }
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); }
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)); }