public void Setup() { _returnRequest = new UnreferencedSwipeReturnRequest() { Amount = 100, OrderNumber = "Test1234" }; _executer = new Mock <IWebCommandExecuter>(); }
public void ItShouldThrowArgumentExceptionForInvalidReturn() { // Arrange _bambora.WebCommandExecuter = _executer.Object; _returnRequest = null; // Act var ex = (ArgumentNullException)Assert.Throws(typeof(ArgumentNullException), () => _bambora.Payments.UnreferencedReturn(_returnRequest)); // Assert Assert.That(ex.ParamName, Is.EqualTo("returnRequest")); }
/// <summary> /// Return a previous swipe payment that was not made through Beanstream. Use this if you would like to /// return a payment but that payment was performed on another payment service. /// /// You must have this capability enabled on your account by calling Beanstream support. It is dangerous to /// have it enabled as the API will not check if you have a transaction ID. /// </summary> /// <returns>The return result</returns> /// <param name="returnRequest">Return request.</param> public PaymentResponse UnreferencedReturn(UnreferencedSwipeReturnRequest returnRequest) { Gateway.ThrowIfNullArgument(returnRequest, "returnRequest"); var url = BeanstreamUrls.ReturnsUrl .Replace("{v}", string.IsNullOrEmpty(_configuration.Version) ? "v1" : "v" + _configuration.Version) .Replace("{p}", string.IsNullOrEmpty(_configuration.Platform) ? "www" : _configuration.Platform) .Replace("{id}", "0"); // uses ID 0 since there is no existing payment ID for this transaction var req = CreateWebRequest(); returnRequest.MerchantId = _configuration.MerchantId.ToString(); var response = req.ProcessTransaction(HttpMethod.Post, url, returnRequest); return(JsonConvert.DeserializeObject <PaymentResponse>(response)); }
public void Setup() { _returnRequest = new UnreferencedSwipeReturnRequest() { Amount = 100, OrderNumber = "Test1234" }; _executer = new Mock <IWebCommandExecuter>(); _bambora = new Gateway() { MerchantId = 300200578, PaymentsApiKey = "4BaD82D9197b4cc4b70a221911eE9f70", ReportingApiKey = "4e6Ff318bee64EA391609de89aD4CF5d", ProfilesApiKey = "D97D3BE1EE964A6193D17A571D9FBC80", ApiVersion = "1" }; }
public void Setup() { _returnRequest = new UnreferencedSwipeReturnRequest() { Amount = 100, OrderNumber = "Test1234" }; _executer = new Mock <IWebCommandExecuter>(); _bambora = new Gateway() { MerchantId = Constants.MerchantId, SubMerchantId = Constants.SubMerchantId, PaymentsApiKey = Constants.PaymentsApiKey, ReportingApiKey = Constants.ReportingApiKey, ProfilesApiKey = Constants.ProfilesApiKey, ApiVersion = Constants.ApiVersion }; }
public void ItShouldThrowArgumentExceptionForInvalidReturn() { // Arrange Gateway beanstream = new Gateway() { MerchantId = 300200578, PaymentsApiKey = "4BaD82D9197b4cc4b70a221911eE9f70", ApiVersion = "1" }; beanstream.WebCommandExecuter = _executer.Object; _returnRequest = null; // Act var ex = (ArgumentNullException)Assert.Throws(typeof(ArgumentNullException), () => beanstream.Payments.UnreferencedReturn(_returnRequest)); // Assert Assert.That(ex.ParamName, Is.EqualTo("returnRequest")); }
/// <summary> /// Return a previous swipe payment that was not made through Bambora. Use this if you would like to /// return a payment but that payment was performed on another payment service. /// /// You must have this capability enabled on your account by calling Bambora support. It is dangerous to /// have it enabled as the API will not check if you have a transaction ID. /// </summary> /// <returns>The return result</returns> /// <param name="returnRequest">Return request.</param> public PaymentResponse UnreferencedReturn(UnreferencedSwipeReturnRequest returnRequest) { Gateway.ThrowIfNullArgument(returnRequest, "returnRequest"); string url = BamboraUrls.ReturnsUrl .Replace("{v}", String.IsNullOrEmpty(_configuration.Version) ? "v1" : "v" + _configuration.Version) .Replace("{p}", String.IsNullOrEmpty(_configuration.Platform) ? "www" : _configuration.Platform) .Replace("{id}", "0"); // uses ID 0 since there is no existing payment ID for this transaction HttpsWebRequest req = new HttpsWebRequest() { MerchantId = _configuration.MerchantId, Passcode = _configuration.PaymentsApiPasscode, WebCommandExecutor = _webCommandExecuter }; returnRequest.MerchantId = _configuration.MerchantId.ToString(); string response = req.ProcessTransaction(HttpMethod.Post, url, returnRequest); return(JsonConvert.DeserializeObject <PaymentResponse>(response)); }