コード例 #1
0
        /// <summary>
        /// Processes the PTS file.
        /// </summary>
        public virtual async Task Process()
        {
            Collection <OutstandingReferredRedemptionReward> result = WorkerActions.RetrieveOutstandingReferredRedemptionRewardRecords(RewardOperations, Context);

            if (OnRewardsPtsBuild != null)
            {
                // Marshal OutstandingReferredRedemptionReward records into the OutstandingRedeemedDealInfo records expected by the PTS builder.
                Collection <OutstandingRedeemedDealInfo> outstandingRedeemedDealInfoList = new Collection <OutstandingRedeemedDealInfo>();
                foreach (OutstandingReferredRedemptionReward outstandingReward in result)
                {
                    outstandingRedeemedDealInfoList.Add(new OutstandingRedeemedDealInfo
                    {
                        RedeemedDealId          = outstandingReward.RedeemedDealId,
                        PartnerMerchantId       = "221042079998",
                        MerchantName            = "REFER FRIEND",
                        OfferId                 = "qqqqqqqqqq",
                        AcquirerReferenceNumber = "24601",
                        Token            = outstandingReward.PartnerCardId,
                        DiscountAmount   = Int32.Parse(outstandingReward.Reward),
                        TransactionDate  = outstandingReward.PayoutScheduledDate,
                        ReferenceNumber  = outstandingReward.TrackedRedemptionRewardsId,
                        SettlementAmount = 0,
                        DiscountId       = String.Empty,
                        DealId           = String.Empty,
                        PartnerData      = null
                    });
                }

                // FDC requires EST.
                TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
                DateTime     estNow      = TimeZoneInfo.ConvertTime(DateTime.UtcNow, easternZone);

                // this will ftp the data and store it in blob
                // Always construct file as sequence number of 3, because PTS job runs once a day and this will be after Visa dump
                string ptsFileContents = PtsBuilder.Build(outstandingRedeemedDealInfoList, estNow, 3, true);
                await OnRewardsPtsBuild(ptsFileContents).ConfigureAwait(false);

                // now update db
                UpdateOutstandingReferredRedemptionRewards(result, RewardPayoutStatus.Pending);
            }
        }
コード例 #2
0
        /// <summary>
        /// Processes the PTS file.
        /// </summary>
        public async Task Process()
        {
            Collection <OutstandingRedeemedDealInfo> result = WorkerActions.RetrieveOutstandingPartnerRedeemedDealRecords(Partner.FirstData,
                                                                                                                          RedeemedDealOperations, Context);

            if (OnPtsBuild != null)
            {
                // FDC requires EST.
                TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
                DateTime     estNow      = TimeZoneInfo.ConvertTime(DateTime.UtcNow, easternZone);

                // this will ftp the data and store it in blob
                // Always construct file as sequence number of 1, because FDC PTS job runs first each day.
                string ptsFileContents = PtsBuilder.Build(result, estNow, 1);
                await OnPtsBuild(ptsFileContents).ConfigureAwait(false);

                // now update db
                UpdatePendingRedeemedDeals(result, CreditStatus.StatementCreditRequested);

                if (TransactionPublisher != null)
                {
                    foreach (OutstandingRedeemedDealInfo outstandingRedeemedDealInfo in result)
                    {
                        TransactionDetail transactionDetail = new TransactionDetail()
                        {
                            TransactionDate  = outstandingRedeemedDealInfo.TransactionDate.ToString("yyMMdd-HHmmss"),
                            DealId           = outstandingRedeemedDealInfo.DealId,
                            DiscountId       = outstandingRedeemedDealInfo.DiscountId,
                            DiscountAmount   = outstandingRedeemedDealInfo.DiscountAmount,
                            SettlementAmount = outstandingRedeemedDealInfo.SettlementAmount
                        };

                        await TransactionPublisher.PublishTransactionAsync(transactionDetail).ConfigureAwait(false);
                    }
                }
            }
        }