Example #1
0
        public void SetUp()
        {
            createChargeback = new CreateIssuerChargeback(transactionData.Object,
                                                          transactions.Object,
                                                          claims.Object,
                                                          chargebacks.Object);

            mscMcomPool = new MscMcomPool();
            mscMcomPool.ClearingRefKey  = 1;
            mscMcomPool.ProvisionRefKey = 2;
            mscMcomPool.McomRefNo       = null;

            var mscTransactionData = new MscTransaction
            {
                F002 = "1234567890123456"
            };

            transactionData.Setup(f => f.GetIssuerData(mscMcomPool)).Returns(mscTransactionData);
        }
Example #2
0
        public void Create_NoTransactionNoClaimSavedBefore_GetChargebackIdInMcomRefNo()
        {
            //arrange  9
            var mscTransactionData = new MscTransaction
            {
                F002    = "1234567890123456",
                F012_s1 = "180904"
            };
            var transactionSearchResponse = new TransactionSearchResponse
            {
                authorizationSummaryCount = "1",
                authorizationSummary      = new List <AuthorizationSummary>
                {
                    new AuthorizationSummary
                    {
                        clearingSummary = new List <ClearingSummary>
                        {
                            new ClearingSummary
                            {
                                transactionId = "123"
                            }
                        }
                    }
                }
            };

            transactionData.Setup(f => f.GetTransactionId(mscMcomPool.ProvisionRefKey)).Returns((MscMcomTransaction)null);
            transactionData.Setup(f => f.GetIssuerData(mscMcomPool)).Returns(mscTransactionData);
            transactionData.Setup(f => f.GetClaim(It.IsAny <String>())).Returns((MscMcomClaim)null);
            transactions.Setup(f => f.Search(It.IsAny <long>(), It.IsAny <TransactionSearchRequest>())).Returns(transactionSearchResponse);
            chargebacks.Setup(f => f.Create(It.IsAny <long>(), claimId, It.IsAny <ChargebackFillRequest>())).Returns(chargebackId);
            claims.Setup(f => f.CreateClaim(It.IsAny <long>(), It.IsAny <ClaimRequest>())).Returns(claimId);
            //act
            createChargeback.Create(mscMcomPool);
            //assert
            Assert.That(mscMcomPool.McomRefNo, Is.Not.Null);
            Assert.That(mscMcomPool.McomRefNo, Is.EqualTo(chargebackId));

            transactionData.Verify(f => f.GetTransactionId(It.IsAny <long>()));
            transactionData.Verify(f => f.GetIssuerData(mscMcomPool));
            transactionData.Verify(f => f.CreateTransactionId(It.IsAny <MscMcomTransaction>()));
        }
        public void Create_ReversalCreate_TakeReversalId()
        {
            //arrange
            var mscTransactionData = new MscTransaction()
            {
                PrevClearingNo = 11
            };
            var mscMcomClaim = new MscMcomClaim()
            {
                ClaimId = claimId
            };
            var cbRevMscMcomPool = new MscMcomPool();

            transactionData.Setup(f => f.GetIssuerData(mscMcomPool)).Returns(mscTransactionData);
            transactionData.Setup(f => f.GetMscMcomPoolClearingNo(mscTransactionData.PrevClearingNo, ApiConstants.PoolActionType.Chargeback)).Returns(cbRevMscMcomPool);
            transactionData.Setup(f => f.GetClaim(mscTransactionData.ProvGuid)).Returns(mscMcomClaim);
            chargebacks.Setup(f => f.CreateReversal(It.IsAny <long>(), It.IsAny <ChargebackRequest>())).Returns(chargebackId);
            //act
            createChargebackReversal.Create(mscMcomPool);
            //assert
            Assert.That(mscMcomPool.McomRefNo, Is.Not.Null);
            Assert.That(mscMcomPool.McomRefNo, Is.EqualTo(chargebackId));
        }