예제 #1
0
        public void Create(MscMcomPool mscMcomPool)
        {
            var mscTransactionData = _iTransactionData.GetIssuerData(mscMcomPool);
            //reversalı yapılan chargeback işleminin chargeback id si pool dan bulunur
            MscMcomPool cbMscMcomPool = _iTransactionData.GetMscMcomPoolClearingNo(mscTransactionData.ClrNo, ApiConstants.PoolActionType.Chargeback);
            //claim transaction bilgisi ile bulunur
            MscMcomClaim mscMcomClaim = _iTransactionData.GetClaim(mscTransactionData.ProvGuid);
            //reversal request oluşturulur
            ChargebackRequest chargebackRequest = new ChargebackRequest();

            chargebackRequest.claimId      = mscMcomClaim.ClaimId;
            chargebackRequest.chargebackId = cbMscMcomPool.McomRefNo;

            //update datası hazırlanır.
            ClrDocumentInfo clrDocumentInfo = _iTransactionData.GetDocumentInfo(mscTransactionData.Guid, ApiConstants.PoolActionType.ChargebackDocument);

            if (clrDocumentInfo == null)
            {
                throw new Exception("Document not found for update");
            }

            ChargebackFillRequest chargebackFillRequest = new ChargebackFillRequest();

            chargebackFillRequest.fileAttachment = _iTransactionData.GetAttachment(clrDocumentInfo);
            //memo bilgisi elde edilir.
            chargebackFillRequest.memo = clrDocumentInfo.Description;

            //Chargeback reversal servisi cagrılır.
            mscMcomPool.ResponseStatus = "";
            mscMcomPool.ClaimId        = mscMcomClaim.ClaimId;
            mscMcomPool.McomRefNo      = _iChargebacks.Update(mscMcomPool.ClearingRefKey, chargebackRequest, chargebackFillRequest);
        }
예제 #2
0
        /// <summary>
        /// Chargeback update
        /// </summary>
        /// <param name="claimId">Claim id</param>
        /// <param name="chargebackRequest">chargeback data</param>
        /// <returns>chargebackId</returns>
        public String Update(long refKey, ChargebackRequest chargebackRequest, ChargebackFillRequest chargebackFillRequest)
        {
            String restUrl = String.Format("claims/{0}/chargebacks/{1}", chargebackRequest.claimId, chargebackRequest.chargebackId);
            var    result  = _apiController.Update <ChargebackResponse>(refKey, restUrl, null, chargebackFillRequest);

            return(result.chargebackId);
        }
예제 #3
0
        /// <summary>
        ///  claim bulunur database de varsa o alınır yoksa yeni bir claim yaratılır.
        ///  transaction tanımında claim varsa alır yoksa mastercard sistemden claim numarası alır.
        ///  alınan claim transaction uzerine kaydeder.
        /// </summary>
        /// <param name="mscMcomPool"></param>
        /// <param name="chargebackFillRequest"></param>
        /// <param name="mscMcomTransactionId"></param>
        /// <returns></returns>
        private MscMcomClaim GetMscMcomClaim(MscMcomPool mscMcomPool, ChargebackFillRequest chargebackFillRequest, MscMcomTransaction mscMcomTransactionId)
        {
            MscMcomClaim mscMcomClaim = null;

            if (!String.IsNullOrWhiteSpace(mscMcomTransactionId.ClaimId))
            {
                mscMcomClaim = _iTransactionData.GetClaim(mscMcomTransactionId.ClaimId);
            }

            if (mscMcomClaim == null)
            {
                mscMcomClaim = new MscMcomClaim();

                var claimRequest = new ClaimRequest();
                claimRequest.clearingTransactionId = mscMcomTransactionId.ClearingTransactionId;
                claimRequest.disputedAmount        = chargebackFillRequest.amount;
                claimRequest.disputedCurrency      = chargebackFillRequest.currency;
                claimRequest.claimType             = "Standard";
                mscMcomClaim.ClaimId = _iClaims.CreateClaim(mscMcomPool.ClearingRefKey, claimRequest);
                mscMcomClaim.ClearingTransactionId = mscMcomTransactionId.ClearingTransactionId;
                mscMcomClaim.ClrKey     = mscMcomPool.ClearingRefKey;
                mscMcomClaim.AuthKey    = mscMcomPool.ProvisionRefKey;
                mscMcomClaim.ClaimStatu = "OPEN";
                _iTransactionData.CreateClaim(mscMcomClaim);
                mscMcomTransactionId.ClaimId = mscMcomClaim.ClaimId;
                _iTransactionData.UpdateClaimId(mscMcomTransactionId);
            }

            return(mscMcomClaim);
        }
예제 #4
0
        public void Ent_Create_GetChargebackId_ReturnChargebackId()
        {
            String chargebackId = "300002063556";

            //assign
            apiController.Setup(f => f.Create <ChargebackResponse>(It.IsAny <long>(), It.IsAny <String>(), It.IsAny <ChargebackFillRequest>()))
            .Returns(new ChargebackResponse()
            {
                chargebackId = chargebackId
            });

            chargebackRequest                         = new ChargebackFillRequest();
            chargebackRequest.currency                = "USD";
            chargebackRequest.documentIndicator       = "true";
            chargebackRequest.messageText             = "test message";
            chargebackRequest.amount                  = "100.00";
            chargebackRequest.fileAttachment.filename = "test.tif";
            chargebackRequest.fileAttachment.file     = "sample file";
            chargebackRequest.reasonCode              = "4853";
            chargebackRequest.chargebackType          = "ARB_CHARGEBACK";
            //act
            Chargebacks chargeback = new Chargebacks(apiController.Object);
            var         result     = chargeback.Create(0, claimId, chargebackRequest);

            //assert
            Assert.That(result, Is.EqualTo(chargebackId));
        }
예제 #5
0
        public void Ent_Update()
        {
            String chargebackId = "974455";

            chargebackRequest = new ChargebackFillRequest();

            apiController.Setup(f => f.Update <ChargebackResponse>(It.IsAny <long>(), It.IsAny <String>(), null, It.IsAny <ChargebackFillRequest>()))
            .Returns(new ChargebackResponse()
            {
                chargebackId = chargebackId
            });

            chargebackRequest.memo = "This is a test memo";
            chargebackRequest.fileAttachment.filename = "test.tif";
            chargebackRequest.fileAttachment.file     = "sample file";
            Chargebacks chargeback = new Chargebacks(apiController.Object);
            var         result     = chargeback.Update(0, new ChargebackRequest
            {
                claimId      = claimId,
                chargebackId = chargebackId
            }, chargebackRequest);

            //assert
            Assert.That(result, Is.EqualTo(chargebackId));
        }
예제 #6
0
        public void Create(MscMcomPool mscMcomPool)
        {
            //yapılan chargeback datası alınmakta.
            ChargebackFillRequest chargebackFillRequest = GetChargebackData(mscMcomPool);
            //Chargeback yapılacak transaction mastrercom tarafından bulunur. Clearingtransaction id alınır.
            MscMcomTransaction mscMcomTransactionId = GetMscMcomTransactionId(mscMcomPool);
            //claim bulunur.
            MscMcomClaim mscMcomClaim = GetMscMcomClaim(mscMcomPool, chargebackFillRequest, mscMcomTransactionId);

            //chargeback üretilir.
            mscMcomPool.ResponseStatus = "INITIAL";
            mscMcomPool.ClaimId        = mscMcomClaim.ClaimId;
            mscMcomPool.McomRefNo      = _iChargebacks.Create(mscMcomPool.ClearingRefKey, mscMcomClaim.ClaimId, chargebackFillRequest);
        }
예제 #7
0
        public void Ent_Update()
        {
            String chargebackId = "974455";

            chargebackRequest = new ChargebackFillRequest();

            chargebackRequest.memo = "This is a test memo";
            chargebackRequest.fileAttachment.filename = "test.tif";
            chargebackRequest.fileAttachment.file     = "sample file";
            Chargebacks chargeback = new Chargebacks(apiController);
            var         result     = chargeback.Update(new ChargebackRequest
            {
                claimId      = claimId,
                chargebackId = chargebackId
            }, chargebackRequest);

            //assert
            Assert.That(result, Is.EqualTo("974455"));
        }
예제 #8
0
        public void Ent_Create_GetChargebackId_ReturnChargebackId()
        {
            //assign
            chargebackRequest                         = new ChargebackFillRequest();
            chargebackRequest.currency                = "USD";
            chargebackRequest.documentIndicator       = "true";
            chargebackRequest.messageText             = "test message";
            chargebackRequest.amount                  = "100.00";
            chargebackRequest.fileAttachment.filename = "test.tif";
            chargebackRequest.fileAttachment.file     = "sample file";
            chargebackRequest.reasonCode              = "4853";
            chargebackRequest.chargebackType          = "ARB_CHARGEBACK";
            //act
            Chargebacks chargeback = new Chargebacks(apiController);
            var         result     = chargeback.Create(claimId, chargebackRequest);

            //assert
            Assert.That(result, Is.EqualTo("300002063556"));
        }
예제 #9
0
        private ChargebackFillRequest GetChargebackData(MscMcomPool mscMcomPool)
        {
            var mscTransactionData = _iTransactionData.GetIssuerData(mscMcomPool);
            ChargebackFillRequest chargebackFillRequest = new ChargebackFillRequest();

            chargebackFillRequest.documentIndicator = mscTransactionData.F072;
            chargebackFillRequest.messageText       = mscTransactionData.F072;
            chargebackFillRequest.amount            = mscTransactionData.F004.ToString(CultureInfo.GetCultureInfo("en-US"));
            chargebackFillRequest.currency          = mscTransactionData.F049;
            chargebackFillRequest.reasonCode        = mscTransactionData.F025;
            chargebackFillRequest.chargebackType    = ApiConstants.ChargebackStatus.Chargeback;
            chargebackFillRequest.memo = mscTransactionData.F072;
            ClrDocumentInfo clrDocumentInfo = _iTransactionData.GetDocumentInfo(mscTransactionData.Guid, ApiConstants.PoolActionType.ChargebackDocument);

            if (clrDocumentInfo != null)
            {
                chargebackFillRequest.fileAttachment = _iTransactionData.GetAttachment(clrDocumentInfo);
            }
            return(chargebackFillRequest);
        }
예제 #10
0
        /// <summary>
        /// Chargeback create
        /// </summary>
        /// <param name="claimId">Claim id</param>
        /// <param name="chargebackRequest">chargeback data</param>
        /// <returns>chargebackId</returns>
        public String Create(long refKey, String claimId, ChargebackFillRequest chargebackRequest)
        {
            var result = _apiController.Create <ChargebackResponse>(refKey, String.Format("claims/{0}/chargebacks", claimId), chargebackRequest);

            return(result.chargebackId);
        }