Ejemplo n.º 1
0
        public void TestCloudApiTransactionStatusResponseSuccess()
        {
            var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
            var client         =
                CreateMockTestClientPosCloudApiRequest("Mocks/terminalapi/pospayment-transaction-status-response.json");
            var payment           = new PosPaymentCloudApi(client);
            var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);

            try
            {
                var transactionStatusResponse = (TransactionStatusResponse)saleToPoiResponse.MessagePayload;
                var messagePayloadResponse    = transactionStatusResponse.RepeatedMessageResponse
                                                .RepeatedResponseMessageBody.MessagePayload;
                Assert.IsNotNull(saleToPoiResponse);
                Assert.AreEqual(saleToPoiResponse.MessageHeader.ServiceID, "35543420");
                Assert.AreEqual(saleToPoiResponse.MessageHeader.SaleID, "TOSIM_1_1_6");
                Assert.AreEqual(saleToPoiResponse.MessageHeader.POIID, "P400Plus-12345678");
                Assert.AreEqual(transactionStatusResponse.Response.Result, ResultType.Success);
                Assert.AreEqual(messagePayloadResponse.PaymentResult.PaymentInstrumentData.CardData.EntryMode[0],
                                EntryModeType.ICC);
                Assert.AreEqual(messagePayloadResponse.POIData.POIReconciliationID, "1000");
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 2
0
 public void TestCloudApiReversalResponse()
 {
     try
     {
         //Create a mock pos payment request
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         var client         =
             CreateMockTestClientPosCloudApiRequest(
                 "Mocks/terminalapi/pospayment-reversal-response-success.json");
         var payment           = new PosPaymentCloudApi(client);
         var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
         Assert.IsNotNull(saleToPoiResponse);
         var response = (ReversalResponse)saleToPoiResponse.MessagePayload;
         Assert.AreEqual(response.Response.Result, ResultType.Success);
         Assert.AreEqual(response.Response.AdditionalResponse, "store=Store1234&currency=EUR");
         Assert.AreEqual(response.POIData.POITransactionID.TransactionID, "8515661234567890C");
         Assert.AreEqual(response.Response.Result, ResultType.Success);
         Assert.AreEqual(saleToPoiResponse.MessageHeader.MessageClass, MessageClassType.Service);
         Assert.AreEqual(saleToPoiResponse.MessageHeader.MessageCategory, MessageCategoryType.Reversal);
         Assert.AreEqual(saleToPoiResponse.MessageHeader.SaleID, "POSSystemID123456");
         Assert.AreEqual(saleToPoiResponse.MessageHeader.POIID, "P400Plus-1234567890");
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
Ejemplo n.º 3
0
 public void TestCloudApiSyncRequestEmptyResponse()
 {
     try
     {
         //Create a mock pos payment request
         var paymentRequest    = MockPosApiRequest.CreatePosPaymentRequest();
         var client            = CreateMockTestClientPosCloudApiRequest("");
         var payment           = new PosPaymentCloudApi(client);
         var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
         Assert.IsNull(saleToPoiResponse);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
Ejemplo n.º 4
0
        public void TestCloudApiAsyncRequest()
        {
            try
            {
                //Create a mock pos payment request
                var paymentRequest    = MockPosApiRequest.CreatePosPaymentRequest();
                var client            = CreateMockTestClientPosCloudApiRequest("Mocks/terminalapi/pospayment-success.json");
                var payment           = new PosPaymentCloudApi(client);
                var saleToPoiResponse = payment.TerminalApiCloudAsync(paymentRequest);

                Assert.IsNotNull(saleToPoiResponse);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
 public void TestTerminalApiRequestEmptyResponse()
 {
     try
     {
         //encrypt the request using encryption credentials
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         //create a mock client
         var client             = CreateMockTestClientPosLocalApiRequest("");
         var posPaymentLocalApi = new PosPaymentLocalApi(client);
         var saleToPoiResponse  = posPaymentLocalApi.TerminalApiLocal(paymentRequest, _encryptionCredentialDetails);
         Assert.IsNull(saleToPoiResponse);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
 public void TestTerminalApiRequestRemoteCertificationException()
 {
     try
     {
         //encrypt the request using encryption credentials
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         //create a mock client
         var client             = CreateMockTestClientPosLocalApiRequest("Mocks/terminalapi/pospayment-encrypted-success.json");
         var posPaymentLocalApi = new PosPaymentLocalApi(client);
         var configEndpoint     = posPaymentLocalApi.Client.Config.Endpoint;
         var saleToPoiResponse  = posPaymentLocalApi.TerminalApiLocal(paymentRequest, _encryptionCredentialDetails,
                                                                      null);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "RemoteCertificateValidationCallback is a required property for TerminalApiLocal and cannot be null");
     }
 }
Ejemplo n.º 7
0
 public void TestTerminalApiRequestEmptyResponse()
 {
     try
     {
         //encrypt the request using encryption credentials
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         //create a mock client
         var client             = CreateMockTestClientPosLocalApiRequest("");
         var posPaymentLocalApi = new PosPaymentLocalApi(client);
         var configEndpoint     = posPaymentLocalApi.Client.Config.Endpoint;
         var saleToPoiResponse  = posPaymentLocalApi.TerminalApiLocal(paymentRequest, _encryptionCredentialDetails,
                                                                      (sender, certificate, chain, errors) => { return(true); });
         Assert.IsNull(saleToPoiResponse);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
Ejemplo n.º 8
0
 public void TestTerminalApiRequest()
 {
     try
     {
         //encrypt the request using encryption credentials
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         //create a mock client
         var client             = CreateMockTestClientPosLocalApiRequest("Mocks/terminalapi/pospayment-encrypted-success.json");
         var posPaymentLocalApi = new PosPaymentLocalApi(client);
         var configEndpoint     = posPaymentLocalApi.Client.Config.Endpoint;
         var saleToPoiResponse  = posPaymentLocalApi.TerminalApiLocal(paymentRequest, _encryptionCredentialDetails);
         Assert.AreEqual(configEndpoint, @"https://_terminal_:8443/nexo/");
         Assert.IsNotNull(saleToPoiResponse);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
Ejemplo n.º 9
0
 public void InputRequestTest()
 {
     try
     {
         //encrypt the request using encryption credentials
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         //create a mock client
         var client             = CreateMockTestClientPosLocalApiRequest("Mocks/terminalapi/input-request-response.json");
         var posPaymentLocalApi = new PosPaymentCloudApi(client);
         var configEndpoint     = posPaymentLocalApi.Client.Config.Endpoint;
         var saleToPoiResponse  = posPaymentLocalApi.TerminalApiCloudSync(paymentRequest);
         Assert.IsNotNull(saleToPoiResponse);
         var inputResponse = (InputResponse)saleToPoiResponse.MessagePayload;
         Assert.AreEqual(inputResponse.InputResult.Input.MenuEntryNumber.Length, 2);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
        public void RepeatedResponseTest()
        {
            try
            {
                //encrypt the request using encryption credentials
                var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
                //create a mock client
                var client = CreateMockTestClientPosCloudApiRequest("Mocks/terminalapi/repeated-response-message.json");
                var posPaymentCloudApiApi = new PosPaymentCloudApi(client);

                var saleToPoiResponse = posPaymentCloudApiApi.TerminalApiCloudAsync(paymentRequest);
                Assert.IsNotNull(saleToPoiResponse);
                var repeatedMessageResponse = (TransactionStatusResponse)saleToPoiResponse.MessagePayload;
                Assert.IsNotNull(repeatedMessageResponse);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 11
0
 public void TestCloudApiDisplaySuccessResponse()
 {
     try
     {
         //Create a mock pos payment request
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         var client         =
             CreateMockTestClientPosCloudApiRequest(
                 "Mocks/terminalapi/display-response-success.json");
         var payment           = new PosPaymentCloudApi(client);
         var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
         Assert.IsNotNull(saleToPoiResponse);
         var response = (DisplayResponse)saleToPoiResponse.MessagePayload;
         Assert.AreEqual(response.OutputResult[0].InfoQualify, InfoQualifyType.Display);
         Assert.AreEqual(response.OutputResult[0].Device, DeviceType.CustomerDisplay);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
Ejemplo n.º 12
0
 public void TestCloudApiSyncErrorResponse()
 {
     try
     {
         //Create a mock pos payment request
         var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
         var client         =
             CreateMockTestClientPosCloudApiRequest(
                 "Mocks/terminalapi/pospayment-notification-error-response.json");
         var payment           = new PosPaymentCloudApi(client);
         var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
         var messagePayload    = (EventNotification)saleToPoiResponse.MessagePayload;
         Assert.AreEqual(saleToPoiResponse.MessageHeader.MessageClass, MessageClassType.Event);
         Assert.AreEqual(saleToPoiResponse.MessageHeader.MessageCategory, MessageCategoryType.Event);
         Assert.AreEqual(saleToPoiResponse.MessageHeader.SaleID, "POSSystemID12345");
         Assert.AreEqual(saleToPoiResponse.MessageHeader.POIID, "P400Plus-12345678");
         Assert.AreEqual(messagePayload.EventToNotify, EventToNotifyType.Reject);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
 public void Init()
 {
     //Create a mock pos payment request
     _paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
 }