Defines a set of parameters used to search for a transaction. This is defined as per the Rapid Transaction Filter. Only one of the properties should be provided.
 public void QueryTransaction_ByInvoiceRef_Test()
 {
     var client = CreateRapidApiClient();
     //Arrange
     var transaction = TestUtil.CreateTransaction();
     var r = new Random();
     var randomInvoiceRef = r.Next(100000, 999999);
     transaction.PaymentDetails.InvoiceReference = randomInvoiceRef.ToString();
     //Act
     var response = client.Create(PaymentMethod.Direct, transaction);
     var filter = new TransactionFilter()
     {
         InvoiceReference = response.Transaction.PaymentDetails.InvoiceReference
     };
     var queryResponse = client.QueryTransaction(filter);
     var queryResponse2 = client.QueryInvoiceRef(response.Transaction.PaymentDetails.InvoiceReference);
     //Assert
     Assert.IsNotNull(queryResponse);
     Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse.TransactionStatus.TransactionID);
     Assert.IsNotNull(queryResponse2);
     Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse2.TransactionStatus.TransactionID);
     TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
         queryResponse.Transaction.Customer);
     TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
         queryResponse2.Transaction.Customer);
 }
        public void QueryTransaction_ByAccessCode_Test()
        {
            var client = CreateRapidApiClient();
            //Arrange
            var transaction = TestUtil.CreateTransaction();

            //Act
            var response = client.Create(PaymentMethod.TransparentRedirect, transaction);
            var filter = new TransactionFilter() {AccessCode = response.AccessCode};
            var queryResponse = client.QueryTransaction(filter);
            var queryResponse2 = client.QueryTransaction(response.AccessCode);
            //Assert
            Assert.IsNotNull(queryResponse);
            Assert.IsNotNull(queryResponse2);
            TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
                queryResponse.Transaction.Customer);
            TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
                queryResponse2.Transaction.Customer);
        }
예제 #3
0
 public void SdkInternalErrors_Test()
 {
     //Arrange
     var mockClient = new Mock<IRapidService>();
     mockClient.Setup(x => x.GetErrorCodes()).Returns(new List<string>(new[] { RapidSystemErrorCode.INTERNAL_SDK_ERROR }));
     var client = new RapidClient(mockClient.Object);
     var filter = new TransactionFilter()
     {
        TransactionID  = 123,
        AccessCode = "abc",
        InvoiceNumber = "123",
        InvoiceReference = "123"
     };
     //Act
     var response = client.QueryTransaction(filter);
     //Assert
     Assert.IsNotNull(response.Errors);
     Assert.AreEqual(response.Errors.First(), RapidSystemErrorCode.INTERNAL_SDK_ERROR);
 }
        public void QueryTransaction_ByTransactionId_Test()
        {
            var client = CreateRapidApiClient();
            //Arrange
            var transaction = TestUtil.CreateTransaction();

            //Act
            var response = client.Create(PaymentMethod.Direct, transaction);
            var filter = new TransactionFilter() {TransactionID = response.TransactionStatus.TransactionID};
            var queryResponse = client.QueryTransaction(filter);
            var queryResponse2 = client.QueryTransaction(response.TransactionStatus.TransactionID);
            //Assert
            Assert.IsNotNull(queryResponse);
            Assert.IsNotNull(queryResponse2);
            Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse.TransactionStatus.TransactionID);
            Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse2.TransactionStatus.TransactionID);
            Assert.AreEqual(response.TransactionStatus.Total, queryResponse2.TransactionStatus.Total);
            //TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
            //    queryResponse.Transaction.Customer);
            //TestUtil.AssertReturnedCustomerData_VerifyAllFieldsAreEqual(response.Transaction.Customer,
            //    queryResponse.Transaction.Customer);
            //TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
            //    queryResponse2.Transaction.Customer);
            //TestUtil.AssertReturnedCustomerData_VerifyAllFieldsAreEqual(response.Transaction.Customer,
            //    queryResponse2.Transaction.Customer);
        }
        public void QueryTransaction_InvalidInputData_ReturnVariousErrors()
        {
            var client = CreateRapidApiClient();
            //Arrange
            var filter = new TransactionFilter()
            {
                TransactionID = -1
            };
            //Act
            var queryByIdResponse = client.QueryTransaction(filter);
            //Assert
            Assert.IsNotNull(queryByIdResponse.Errors);
            Assert.AreEqual(queryByIdResponse.Errors.FirstOrDefault(), "S9995");

            //Arrange
            filter = new TransactionFilter()
            {
                AccessCode = "leRandomAccessCode"
            };
            //Act
            var queryByAccessCodeResponse = client.QueryTransaction(filter);
            //Assert
            Assert.IsNull(queryByAccessCodeResponse.Transaction);

            //Arrange
            filter = new TransactionFilter()
            {
                InvoiceNumber = "leRandomInvoiceNumber"
            };
            //Act
            var queryByInvoiceNumberResponse = client.QueryTransaction(filter);
            //Assert
            Assert.IsNotNull(queryByInvoiceNumberResponse.Errors);
            Assert.AreEqual(queryByInvoiceNumberResponse.Errors.FirstOrDefault(), "V6171");

            //Arrange
            filter = new TransactionFilter()
            {
                InvoiceReference = "leRandomInvoiceReference"
            };
            //Act
            var queryByInvoiceRefResponse = client.QueryTransaction(filter);
            //Assert
            Assert.IsNotNull(queryByInvoiceRefResponse.Errors);
            Assert.AreEqual(queryByInvoiceRefResponse.Errors.FirstOrDefault(), "V6171");
        }