public void ASimplePreAuth()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976000000003436",
                CV2         = "452",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var response = judo.PreAuths.Create(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);

            var receipt = response.Response as PaymentReceiptModel;

            Assert.IsNotNull(receipt);
            Assert.AreEqual("Success", receipt.Result);
            Assert.AreEqual("PreAuth", receipt.Type);
        }
        public void ADeclinedValidationOnCardPreAuth()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4221690000004963",
                CV2         = "125",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var response = judo.PreAuths.Validate(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);
            Assert.AreEqual("Your good to go!", response.Response.ErrorMessage);
            Assert.AreEqual(JudoApiError.Validation_Passed, response.Response.ErrorType);
        }
예제 #3
0
        public void PassingBaseAndVersionCorrectlyCreatesClient()
        {
            var credentials         = new Credentials("token", "secret");
            var expectedBaseAddress = "http://test.judopay.com/";
            var client = JudoPaymentsFactory.Create(credentials, expectedBaseAddress, "4.1.0");

            Assert.That(client, Is.Not.Null);
            Assert.That(client.Connection.BaseAddress.ToString(), Is.EqualTo(expectedBaseAddress));
        }
예제 #4
0
        public void GetRefundsTransactions()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976000000003436",
                CV2         = "452",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var paymentResponse = judo.Payments.Create(paymentWithCard).Result;

            Assert.IsNotNull(paymentResponse);
            Assert.IsFalse(paymentResponse.HasError);
            Assert.AreEqual("Success", paymentResponse.Response.Result);

            var refund = new RefundModel
            {
                Amount               = 25,
                ReceiptId            = int.Parse(paymentResponse.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            var response = judo.Refunds.Create(refund).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);
            Assert.AreEqual("Success", response.Response.Result);

            var paymentReceipt = response.Response as PaymentReceiptModel;

            Assert.IsNotNull(paymentReceipt);

            var transactions = judo.Consumers.GetRefunds(paymentReceipt.Consumer.ConsumerToken).Result;

            Assert.IsNotNull(transactions);
            Assert.IsFalse(transactions.HasError);
            Assert.IsNotEmpty(transactions.Response.Results);
// ReSharper disable once PossibleNullReferenceException
            Assert.AreEqual(Configuration.Judoid, transactions.Response.Results.FirstOrDefault().JudoId.ToString(CultureInfo.InvariantCulture));
// ReSharper disable once PossibleNullReferenceException
            Assert.AreEqual(paymentReceipt.ReceiptId, transactions.Response.Results.FirstOrDefault().ReceiptId);
        }
예제 #5
0
        public void PaymentUpdate()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var request = new WebPaymentRequestModel
            {
                Amount      = 10,
                CardAddress = new WebPaymentCardAddress
                {
                    CardHolderName = "Test User",
                    Line1          = "Test Street",
                    Line2          = "Test Street",
                    Line3          = "Test Street",
                    Town           = "London",
                    PostCode       = "W31 4HS",
                    Country        = "England"
                },
                ClientIpAddress       = "127.0.0.1",
                CompanyName           = "Test",
                Currency              = "GBP",
                ExpiryDate            = DateTimeOffset.Now,
                JudoId                = Configuration.Judoid,
                PartnerServiceFee     = 10,
                PaymentCancelUrl      = "http://test.com",
                PaymentSuccessUrl     = "http://test.com",
                Reference             = "42421",
                Status                = WebPaymentStatus.Open,
                TransactionType       = TransactionType.PAYMENT,
                YourConsumerReference = "4235325",
                YourPaymentReference  = "42355"
            };

            var result = judo.WebPayments.Payments.Create(request).Result;

            Assert.NotNull(result);
            Assert.IsFalse(result.HasError);
            Assert.NotNull(result.Response);
            Assert.NotNull(result.Response.Reference);
            Assert.NotNull(result.Response.PostUrl);

            request.Status    = WebPaymentStatus.Paid;
            request.Reference = result.Response.Reference;

            var resultUpdate = judo.WebPayments.Payments.Update(request).Result;

            Assert.NotNull(resultUpdate);
            Assert.IsFalse(resultUpdate.HasError);
            Assert.NotNull(resultUpdate.Response);
            Assert.NotNull(resultUpdate.Response.Reference);
            Assert.AreEqual(result.Response.Reference, resultUpdate.Response.Reference);
            Assert.AreEqual(resultUpdate.Response.Status, resultUpdate.Response.Status);
        }
        public void GetAllMerchants()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.ElevatedPrivilegesSecret,
                                                  Configuration.ElevatedPrivilegesToken,
                                                  Configuration.Baseaddress);

            var merchants = judo.Market.Merchants.Get().Result;

            Assert.IsNotNull(merchants);
            Assert.IsFalse(merchants.HasError);
            Assert.IsNotNull(merchants.Response);
        }
        public void TestProjectOnlyCreateMethod()
        {
            // Given I create a new Judo client with a custom version number
            var judo = JudoPaymentsFactory.Create(new Credentials(Configuration.Token, Configuration.Secret), Configuration.JudoEnvironment, "5.0");

            var paymentWithCard = GetCardPaymentModel("432438862");

            // When I make a call to an api endpoint
            var response = judo.Payments.Create(paymentWithCard).Result;

            // Then I end up getting a response back
            Assert.IsNotNull(response);
            Assert.AreEqual("Success", response.Response.Result);
        }
        public void AFailedSimplePreAuthAndValidateCollection()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976000000003436",
                CV2         = "452",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var response = judo.PreAuths.Create(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);

            var receipt = response.Response as PaymentReceiptModel;

            Assert.IsNotNull(receipt);

            Assert.AreEqual("Success", receipt.Result);
            Assert.AreEqual("PreAuth", receipt.Type);

            var collection = new CollectionModel
            {
                Amount               = 30,
                ReceiptId            = int.Parse(response.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            var validateResponse = judo.Collections.Validate(collection).Result;

            Assert.IsNotNull(validateResponse);
            Assert.IsTrue(validateResponse.HasError);
            Assert.AreEqual("Unable to process collection as total amount collected would exceed value of" +
                            " original PreAuth transaction.", validateResponse.Error.ErrorMessage);
            Assert.AreEqual(JudoApiError.Payment_Failed, validateResponse.Error.ErrorType);
        }
예제 #9
0
        public void ARefundValidate()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976000000003436",
                CV2         = "452",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var response = judo.Payments.Create(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);
            Assert.AreEqual("Success", response.Response.Result);

            var refund = new RefundModel
            {
                Amount               = 25,
                ReceiptId            = int.Parse(response.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            var validateResponse = judo.Refunds.Validate(refund).Result;

            Assert.IsNotNull(validateResponse);
            Assert.IsFalse(validateResponse.HasError);
            Assert.AreEqual("Your good to go!", validateResponse.Response.ErrorMessage);
            Assert.AreEqual(JudoApiError.Validation_Passed, validateResponse.Response.ErrorType);
        }
예제 #10
0
        public void PaymentWithThreedSecure()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.ElevatedPrivilegesSecret,
                                                  Configuration.ElevatedPrivilegesToken,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = "100016",
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976350000006891",
                CardAddress = new CardAddressModel
                {
                    Line1    = "242 Acklam Road",
                    Line2    = "Westbourne Park",
                    Line3    = "",
                    Town     = "London",
                    PostCode = "W105JJ"
                },
                CV2            = "341",
                ExpiryDate     = "12/15",
                MobileNumber   = "07123456789",
                EmailAddress   = "*****@*****.**",
                UserAgent      = "Mozilla/5.0,(Windows NT 6.1; WOW64),AppleWebKit/537.36,(KHTML, like Gecko),Chrome/33.0.1750.154,Safari/537.36",
                AcceptHeaders  = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
                DeviceCategory = "Mobile"
            };

            var response = judo.Payments.Create(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);

            var receipt = response.Response as PaymentRequiresThreeDSecureModel;

            Assert.IsNotNull(receipt);
            Assert.AreEqual("Requires 3D Secure", receipt.Result);
            Assert.IsNotEmpty(receipt.Md);
        }
예제 #11
0
        public void GetPaymentTransactions()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976000000003436",
                CV2         = "452",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var response = judo.Payments.Create(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);
            Assert.AreEqual("Success", response.Response.Result);

            var transaction = judo.Transactions.Get(TransactionType.PAYMENT).Result;

            Assert.IsNotNull(transaction);
            Assert.IsFalse(transaction.HasError);
            Assert.IsNotEmpty(transaction.Response.Results);
            Assert.AreEqual("Success", transaction.Response.Results.First().Result);
            Assert.AreEqual(response.Response.ReceiptId, transaction.Response.Results.First().ReceiptId);
        }
예제 #12
0
        public IApplePayService GetApplePaymentService()
        {
            var judoApi = JudoPaymentsFactory.Create(JudoConfiguration.Instance.Environment, JudoConfiguration.Instance.ApiToken, JudoConfiguration.Instance.ApiSecret);

            return(new ApplePayService(judoApi));
        }
 protected IntegrationTestsBase()
 {
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
     JudoPayApi         = JudoPaymentsFactory.Create(Configuration.JudoEnvironment, Configuration.Token, Configuration.Secret);
     JudoPayApiElevated = JudoPaymentsFactory.Create(Configuration.JudoEnvironment, Configuration.ElevatedPrivilegesToken, Configuration.ElevatedPrivilegesSecret);
 }
예제 #14
0
        public void TokenSecretUrlConstructorCreatesCLient()
        {
            var client = JudoPaymentsFactory.Create("token", "secret", "http://judo");

            Assert.That(client, Is.Not.Null);
        }
예제 #15
0
        public void PassingDuplicateAgentDoesntCauseException()
        {
            var client = JudoPaymentsFactory.Create(JudoEnvironment.Sandbox, "abc", "def", new ProductInfoHeaderValue("DotNetSDK", "1.0.0.0"));

            Assert.That(client, Is.Not.Null);
        }
예제 #16
0
        public void PassingNoUserAgentDoesntCauseException()
        {
            var client = JudoPaymentsFactory.Create(new Credentials("abc", "def"), "http://foo", "5.0.0.0");

            Assert.That(client, Is.Not.Null);
        }
 protected JudoPayApi UseCybersourceGateway()
 {
     return(JudoPaymentsFactory.Create(Configuration.JudoEnvironment, Configuration.Cybersource_Token, Configuration.Cybersource_Secret));
 }
예제 #18
0
        public void TransactionsGetByReceiptId()
        {
            // WebPaymentRequest - Do a web payment
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var request = new WebPaymentRequestModel
            {
                Amount      = 10,
                CardAddress = new WebPaymentCardAddress
                {
                    CardHolderName = "Test User",
                    Line1          = "Test Street",
                    Line2          = "Test Street",
                    Line3          = "Test Street",
                    Town           = "London",
                    PostCode       = "W31 4HS",
                    Country        = "England"
                },
                ClientIpAddress       = "127.0.0.1",
                CompanyName           = "Test",
                Currency              = "GBP",
                ExpiryDate            = DateTimeOffset.Now,
                JudoId                = Configuration.Judoid,
                PartnerServiceFee     = 10,
                PaymentCancelUrl      = "http://test.com",
                PaymentSuccessUrl     = "http://test.com",
                Reference             = "42421",
                Status                = WebPaymentStatus.Open,
                TransactionType       = TransactionType.PAYMENT,
                YourConsumerReference = "4235325",
                YourPaymentReference  = "42355"
            };

            var result = judo.WebPayments.Payments.Create(request).Result;

            var reference = result.Response.Reference;

            // Forms - Post a form with credentials to post url from the webpayment response passing form parameter Reference

            var httpClient  = new HttpClient();
            var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Reference", reference)
            });

            var formRequest = CreateJudoApiRequest(result.Response.PostUrl, HttpMethod.Post, "3.2.0.0", Configuration.Token,
                                                   Configuration.Secret);

            formContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
            formRequest.Content             = formContent;

            var paymentPage = httpClient.SendAsync(formRequest).Result;

            var resultBody = paymentPage.Content.ReadAsStringAsync().Result;

            /* ok this next bit is a hack. I know on Iridium's ACS simulator the PaRes value is lurking in the HTML (It's a simulator after all!) */
            var doc = new HtmlDocument();

            doc.LoadHtml(resultBody);

            // Forms - Post a form with credentials and cookie and form following variables:
            // url= /v1/Pay variables: CardNumber, ExpiryDate, Cv2, form variable: __RequestVerificationToken

            var formField = doc.DocumentNode.SelectSingleNode("//input[@name='__RequestVerificationToken']");

            var requestVerificationToken = formField.GetAttributeValue("value", "");

            //            CardNumber = "4976000000003436",
            //CV2 = "452",
            //ExpiryDate = "12/15",

            formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("__RequestVerificationToken", requestVerificationToken),
                new KeyValuePair <string, string>("CardNumber", "4976000000003436"),
                new KeyValuePair <string, string>("Cv2", "452"),
                new KeyValuePair <string, string>("ExpiryDate", "12/15"),
                new KeyValuePair <string, string>("Reference", reference)
            });

            formRequest = CreateJudoApiRequest("http://127.0.0.1/webpayments/v1/Pay", HttpMethod.Post, "3.2.0.0", Configuration.Token,
                                               Configuration.Secret);

            formContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
            formRequest.Content             = formContent;

            var resultPage = httpClient.SendAsync(formRequest).Result;

            resultBody = resultPage.Content.ReadAsStringAsync().Result;

            // Retrieve from the response the receipt id

            doc = new HtmlDocument();
            doc.LoadHtml(resultBody);

            formField = doc.DocumentNode.SelectSingleNode("//input[@name='ReceiptId']");

            var receiptId = formField.GetAttributeValue("value", "");

            var webRequest = judo.WebPayments.Transactions.GetByReceipt(receiptId).Result;

            Assert.NotNull(webRequest);
            Assert.IsFalse(webRequest.HasError);
            Assert.NotNull(webRequest.Response);
            Assert.NotNull(webRequest.Response.Reference);
            Assert.AreEqual(request.JudoId, webRequest.Response.JudoId);
        }
예제 #19
0
        public void FullPaymentWithThreedSecure()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.ElevatedPrivilegesSecret,
                                                  Configuration.ElevatedPrivilegesToken,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = "100016",
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976350000006891",
                CardAddress = new CardAddressModel
                {
                    Line1    = "242 Acklam Road",
                    Line2    = "Westbourne Park",
                    Line3    = "",
                    Town     = "London",
                    PostCode = "W105JJ"
                },
                CV2            = "341",
                ExpiryDate     = "12/15",
                MobileNumber   = "07123456789",
                EmailAddress   = "*****@*****.**",
                UserAgent      = "Mozilla/5.0,(Windows NT 6.1; WOW64),AppleWebKit/537.36,(KHTML, like Gecko),Chrome/33.0.1750.154,Safari/537.36",
                AcceptHeaders  = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
                DeviceCategory = "Mobile"
            };

            var response = judo.Payments.Create(paymentWithCard).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);

            var receipt = response.Response as PaymentRequiresThreeDSecureModel;

            Assert.IsNotNull(receipt);
            Assert.AreEqual("Requires 3D Secure", receipt.Result);
            Assert.IsNotEmpty(receipt.Md);

            var httpClient  = new HttpClient();
            var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("MD", receipt.Md),
                new KeyValuePair <string, string>("PaReq", receipt.PaReq),
                new KeyValuePair <string, string>("TermUrl", "https://pay.judopay.com/")
            });

            var taskSendMDandPaReqToAcsServer = httpClient.PostAsync(receipt.AcsUrl, formContent).ContinueWith(authResponse =>
            {
                var resultBody = authResponse.Result.Content.ReadAsStringAsync().Result;

                /* ok this next bit is a hack. I know on Iridium's ACS simulator the PaRes value is lurking in the HTML (It's a simulator after all!) */
                var doc = new HtmlDocument();
                doc.LoadHtml(resultBody);

                var formField = doc.DocumentNode.SelectSingleNode("//input[@name='PaRes']");

                var paResValue = formField.GetAttributeValue("value", "");

                Assert.That(paResValue, Is.Not.Empty);

                var threeDResult = judo.ThreeDs.Complete3DSecure(receipt.ReceiptId, new ThreeDResultModel {
                    PaRes = paResValue
                }).Result;

                Assert.IsNotNull(threeDResult);
                Assert.IsFalse(threeDResult.HasError);
                Assert.AreEqual("Success", threeDResult.Response.Result);
            });

            taskSendMDandPaReqToAcsServer.Wait();
        }
예제 #20
0
        public void APreAuthTwoCollectionsAndTwoRefunds()
        {
            var judo = JudoPaymentsFactory.Create(Configuration.Token,
                                                  Configuration.Secret,
                                                  Configuration.Baseaddress);

            var paymentWithCard = new CardPaymentModel
            {
                JudoId = Configuration.Judoid,
                YourPaymentReference  = "578543",
                YourConsumerReference = "432438862",
                Amount      = 25,
                CardNumber  = "4976000000003436",
                CV2         = "452",
                ExpiryDate  = "12/15",
                CardAddress = new CardAddressModel
                {
                    Line1    = "Test Street",
                    PostCode = "W40 9AU",
                    Town     = "Town"
                }
            };

            var preAuthResponse = judo.PreAuths.Create(paymentWithCard).Result;

            Assert.IsNotNull(preAuthResponse);
            Assert.IsFalse(preAuthResponse.HasError);
            Assert.AreEqual("Success", preAuthResponse.Response.Result);

            var collection = new CollectionModel
            {
                Amount               = 24,
                ReceiptId            = int.Parse(preAuthResponse.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            var collection1Response = judo.Collections.Create(collection).Result;

            Assert.IsNotNull(collection1Response);
            Assert.IsFalse(collection1Response.HasError);

            var receipt = collection1Response.Response as PaymentReceiptModel;

            Assert.IsNotNull(receipt);

            Assert.AreEqual("Success", receipt.Result);
            Assert.AreEqual("Collection", receipt.Type);

            collection = new CollectionModel
            {
                Amount               = 1,
                ReceiptId            = int.Parse(preAuthResponse.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            var collection2Response = judo.Collections.Create(collection).Result;

            Assert.IsNotNull(collection2Response);
            Assert.IsFalse(collection2Response.HasError);

            receipt = collection2Response.Response as PaymentReceiptModel;

            Assert.IsNotNull(receipt);

            Assert.AreEqual("Success", receipt.Result);
            Assert.AreEqual("Collection", receipt.Type);

            var refund = new RefundModel
            {
                Amount               = 24,
                ReceiptId            = int.Parse(collection1Response.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            var response = judo.Refunds.Create(refund).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);

            receipt = response.Response as PaymentReceiptModel;

            Assert.IsNotNull(receipt);

            Assert.AreEqual("Success", receipt.Result);
            Assert.AreEqual("Refund", receipt.Type);

            refund = new RefundModel
            {
                Amount               = 1,
                ReceiptId            = int.Parse(collection2Response.Response.ReceiptId),
                YourPaymentReference = "578543"
            };

            response = judo.Refunds.Create(refund).Result;

            Assert.IsNotNull(response);
            Assert.IsFalse(response.HasError);

            receipt = response.Response as PaymentReceiptModel;

            Assert.IsNotNull(receipt);

            Assert.AreEqual("Success", receipt.Result);
            Assert.AreEqual("Refund", receipt.Type);
        }