public void Serialized_properties() { var test = new TestClass { Name = "foo", Age = 4 }; var serializer = new HttpPostSerializer(); var result = serializer.Serialize(test); result.ShouldEqual("Name=foo&Age=4"); }
public TransactionRegistrationResponse Send(RequestContext context, string vendorTxCode, ShoppingBasket basket, Address billingAddress, Address deliveryAddress, string customerEmail) { string sagePayUrl = configuration.RegistrationUrl; string notificationUrl = urlResolver.BuildNotificationUrl(context); var registration = new TransactionRegistration( vendorTxCode, basket, notificationUrl, billingAddress, deliveryAddress, customerEmail, configuration.VendorName); 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 RefundResponse Send(string vendorTxCode, string refundReason, decimal amount, string relatedVpsTxId, string relatedVendorTxCode, string relatedSecurityKey, string relatedAuthNo) { var registration = new RefundRegistration(configuration.VendorName, vendorTxCode, amount, refundReason, relatedVpsTxId, relatedVendorTxCode, relatedSecurityKey, relatedAuthNo); string sagePayUrl = configuration.RefundUrl; var serializer = new HttpPostSerializer(); var postData = serializer.Serialize(registration); var response = requestSender.SendRequest(sagePayUrl, postData); var deserializer = new ResponseSerializer(); return(deserializer.Deserialize <RefundResponse>(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)); }