Пример #1
0
        /// <summary>
        /// Marshals information about a collection of outstanding MasterCard redeemed deals into a collection of MasterCard rebate records.
        /// </summary>
        /// <param name="outstandingRedeemedDeals">
        /// The outstanding redeemed deals to marshal.
        /// </param>
        /// <returns>
        /// The corresponding collection of rebate records.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// Parameter outstandingRedeemedDeals cannot be null.
        /// </exception>
        public static Collection <RebateRecord> MarshalOutstandingRedeemedDeals(Collection <OutstandingRedeemedDealInfo> outstandingRedeemedDeals)
        {
            if (outstandingRedeemedDeals == null)
            {
                throw new ArgumentNullException("outstandingRedeemedDeals", "Parameter outstandingRedeemedDeals cannot be null.");
            }

            Collection <RebateRecord> result = new Collection <RebateRecord>();

            foreach (OutstandingRedeemedDealInfo outstandingRedeemedDeal in outstandingRedeemedDeals)
            {
                KeyClearingData keyClearingData = KeyClearingData.Deserialize(outstandingRedeemedDeal.PartnerData);
                RebateRecord    rebateRecord    = new RebateRecord
                {
                    TransactionSequenceNumber = outstandingRedeemedDeal.AcquirerReferenceNumber,
                    TransactionAmount         = ((decimal)outstandingRedeemedDeal.SettlementAmount / 100),
                    TransactionDate           = outstandingRedeemedDeal.TransactionDate,
                    RebateAmount           = ((decimal)outstandingRedeemedDeal.DiscountAmount / 100),
                    MerchantId             = keyClearingData.MerchantId,
                    IssuerIca              = keyClearingData.IssuerIca,
                    BankCustomerNumber     = keyClearingData.BankCustomerNumber,
                    TransactionDescription = MicrosoftEarnRebateSource
                };

                result.Add(rebateRecord);
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Marshals information from the MasterCard clearing data record into the RedeemedDeal object in the context.
        /// </summary>
        /// <param name="clearingData">
        /// The clearing data record to marshal.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Parameter clearingData cannot be null.
        /// </exception>
        public void MarshalRedeemDeal(ClearingData clearingData)
        {
            if (clearingData == null)
            {
                throw new ArgumentNullException("clearingData", "Parameter clearingData cannot be null.");
            }

            RedeemedDeal redeemedDeal = (RedeemedDeal)Context[Key.RedeemedDeal];

            redeemedDeal.CallbackEvent              = RedemptionEvent.Settlement;
            redeemedDeal.PurchaseDateTime           = clearingData.TransactionDate;
            redeemedDeal.AuthorizationAmount        = (int)(clearingData.TransactionAmount * 100);
            redeemedDeal.Currency                   = "USD";
            redeemedDeal.PartnerRedeemedDealScopeId = clearingData.BankNetRefNumber;

            KeyClearingData keyClearingData = new KeyClearingData
            {
                BankCustomerNumber = clearingData.BankCustomerNumber,
                BankNetRefNumber   = clearingData.BankNetRefNumber,
                MerchantId         = clearingData.MerchantId,
                IssuerIca          = clearingData.IssuerIca
            };

            Context[Key.PartnerData] = keyClearingData.XmlSerialize();

            Context[Key.PartnerCardId]          = clearingData.BankCustomerNumber;
            Context[Key.PartnerMerchantId]      = clearingData.LocationId;
            Context[Key.PartnerMerchantIdType]  = PartnerMerchantIdType.SettlementOnly;
            Context[Key.CreditStatus]           = CreditStatus.ClearingReceived;
            Context[Key.PartnerReferenceNumber] = clearingData.TransactionSequenceNumber;
        }