Example #1
0
        public void TestCloudApiTransactionStatusResponseSuccess()
        {
            var paymentRequest    = MockPosApiRequest.CreatePosPaymentRequest("Request");
            var client            = CreateMockTestClientPosApiRequest("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, "Success");
                Assert.AreEqual(messagePayloadResponse.PaymentResult.PaymentInstrumentData.CardData.EntryMode[0], "ICC");
                Assert.AreEqual(messagePayloadResponse.POIData.POIReconciliationID, "1000");
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Example #2
0
        public void TestCloudApiAsyncRequest()
        {
            try
            {
                //Create a mock pos payment request
                var paymentRequest    = MockPosApiRequest.CreatePosPaymentRequest("Request");
                var client            = CreateMockTestClientPosApiRequest("Mocks/terminalapi/pospayment-success.json");
                var payment           = new PosPaymentCloudApi(client);
                var saleToPoiResponse = payment.TerminalApiCloudAsync(paymentRequest);

                Assert.IsNotNull(saleToPoiResponse);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Example #3
0
        public void TestTerminalApiRequest()
        {
            try
            {
                //encrypt the request using encryption credentials
                var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest("Request");
                //create a mock client
                var client            = CreateMockTestClientPosApiRequest("Mocks/terminalapi/pospayment-encrypted-success.json");
                var payment           = new PosPaymentLocalApi(client);
                var configEndpoint    = payment.Client.Config.Endpoint;
                var saleToPoiResponse = payment.TerminalApiLocal(paymentRequest, _encryptionCredentialDetails);

                Assert.AreEqual(configEndpoint, @"https://_terminal_:8443/nexo/");
                Assert.IsNotNull(saleToPoiResponse);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Example #4
0
        public void TestTerminalApiRequest()
        {
            try
            {
                //dummy header
                var messageHeader = MockNexoMessageHeaderRequest();

                //encrypt the request using encryption credentials
                var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest("Request");
                //create a mock client
                var client            = CreateMockTestClientPosApiRequest("Mocks/pospayment-encrypted-success.json");
                var payment           = new PosPayment(client);
                var saleToPoiResponse = payment.TerminalApiLocal(paymentRequest, messageHeader, _encryptionCredentialDetails);

                Assert.IsNotNull(saleToPoiResponse);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }