Exemplo n.º 1
0
        public void PaymentService_ShouldGenerateMpambaPaymentFromAgent()
        {
            //Given or Arrange
            var phoneNumber = "+265888123321";
            var textMessage = @"
                Cash In from 263509-RODGERS LETALA on
                09/08/2020 09:43:32.
                Amt: 5,500.00MWK
                Fee: 0.00MWK
                Ref: 7H948UWUV8
                Bal: 5,557.96MWK
            ";

            //When or Act
            MpambaService service = GetService(phoneNumber, textMessage);
            Payment       payment = service.GeneratePayment();

            //Then or Assert
            payment.Amount.Should().Be(5500);
            payment.Reference.Should().Be("7H948UWUV8");
            payment.AgentName.Should().Be("263509-RODGERSLETALA");
            payment.Amount.Should().BeOfType(typeof(Decimal));

            service.IsDeposit().Should().Be(true);
            service.HasInvalidReference().Should().Be(false);
        }
Exemplo n.º 2
0
        public void PaymentService_ShouldSanitizeMessage()
        {
            var phoneNumber = "+265888123321";
            var textMessage = @"
                Cash In from 263509-RODGERS LETALA on
                09/08/2020 09:43:32.
                Amt: 5,500.00MWK
                Fee: 0.00MWK
                Ref: 7H948UWUV8
                Bal: 5,557.96MWK
            ";

            var sanitizedMessage = "CashInfrom263509-RODGERSLETALAon09/08/202009:43:32.Amt:5,500.00MWKFee:0.00MWKRef:7H948UWUV8Bal:5,557.96MWK";

            //When or Act
            MpambaService mpambaService = GetService(phoneNumber, textMessage);

            mpambaService._message.Should().Be(sanitizedMessage);
        }
Exemplo n.º 3
0
        public void PaymentService_ShouldSanitizeMessage()
        {
            var phoneNumber = "+265888123321";
            var textMessage = @"
                Cash In from 263509-RODGERS LETALA on
                09/08/2020 09:43:32.
                Amt: 5,500.00MWK
                Fee: 0.00MWK
                Ref: 7H948UWUV8
                Bal: 5,557.96MWK
            ";

            //TODO: Make this test pass
            //TODO: Sanization Logic is in the IPaymentService interface`
            // var sanitizedMessage = @"CashInfrom263509-RODGERSLETALAon09/08/2020 09:43:32.Amt:5,500.00MWKFee0.00MWKRef:7H948UWUV8Bal:5,557.96MWK";

            //When or Act
            MpambaService mpambaService = GetService(phoneNumber, textMessage);
            // mpambaService._message.Should().Be(sanitizedMessage);
        }