/// <summary> /// Method to get all lineitem list foe budget as per time frame /// </summary> /// <param name="BudgetDetailId"></param> /// <param name="IsQuaterly"></param> /// <returns></returns> public ActionResult GetFinanceLineItemData(int BudgetDetailId, string TimeFrame = "quarters") { LineItemDetail AlllineItemdetail = new LineItemDetail(); if (BudgetDetailId > 0) { #region "Set Create/Edit or View permission for Budget and Forecast to Global varialble." _IsBudgetCreate_Edit = AuthorizeUserAttribute.IsAuthorized(Enums.ApplicationActivity.BudgetCreateEdit); _IsForecastCreate_Edit = AuthorizeUserAttribute.IsAuthorized(Enums.ApplicationActivity.ForecastCreateEdit); #endregion AlllineItemdetail = _MarketingBudget.GetLineItemGrid(BudgetDetailId, Sessions.User.CID, TimeFrame, Sessions.PlanExchangeRate); ViewBag.HasLineItems = AlllineItemdetail.childLineItemCount; } return(PartialView("_LineItem", AlllineItemdetail.LineItemGridData)); }
public Task <IServiceResult <LineItemDetail> > GetInvoiceLineItemDetail(int invoiceId, int lineItemId) { var mock = new LineItemDetail { NetAmount = 210.00.ToString(), Date = DateTime.Now.ToString(), FlagCount = 3.ToString(), InvoiceId = invoiceId, LineItemId = lineItemId, TimeKeeper = "Bob" }; var result = new Task <IServiceResult <LineItemDetail> >(() => new ServiceResult <LineItemDetail>(mock, string.Empty, true)); result.RunSynchronously(TaskScheduler.Default); return(result); }
private LineItemDetail GetLineItemDetail(FlatPrimeRecord flatCargoLineItemDetail, int lineItemNo, int lineItemDetailNo, int batchSequenceNumber, int recordSequenceWithinBatch) { LineItemDetail lineItemDetail = new LineItemDetail(); lineItemDetail.DetailNumber = (lineItemDetailNo + 1).ToString(); lineItemDetail.LineItemNumber = (lineItemNo + 1).ToString(); lineItemDetail.BatchSequenceNumber = batchSequenceNumber.ToString(); lineItemDetail.RecordSequenceWithinBatch = recordSequenceWithinBatch.ToString(); lineItemDetail.ChargeAmount = new ChargeAmount[] { new ChargeAmount(){ Name = ChargeAmountName.WeightBilled, NameSpecified=true, Value = flatCargoLineItemDetail.DetailsWeightChargeAmount }, new ChargeAmount(){ Name = ChargeAmountName.ValuationBilled, NameSpecified=true, Value = flatCargoLineItemDetail.DetailsValuationChargeAmount } }; #region LineItemDetail Addon Charges //---------------------------------------------------------------- //--Addon Charges //---------------------------------------------------------------- //TODO:Number Format?? List<AddOnCharges> allAddonCharges = new List<AddOnCharges>(); decimal allAddonChargesAmount = 0; //decimal allISCAmount = 0; //decimal allOtherChargesAmount = 0; if (flatCargoLineItemDetail.DetailsISCAllowed != 0) { AddOnCharges addonCharges = new AddOnCharges(); addonCharges.AddOnChargeName = "AmountSubjectToISCAllowed"; addonCharges.AddOnChargeAmount = flatCargoLineItemDetail.DetailsAmountSubjectToISCAllowed; allAddonCharges.Add(addonCharges); addonCharges = new AddOnCharges(); addonCharges.AddOnChargeName = "ISCAllowed"; addonCharges.AddOnChargeAmount = flatCargoLineItemDetail.DetailsISCAllowed; addonCharges.AddOnChargePercentageSpecified = true; addonCharges.AddOnChargePercentage = flatCargoLineItemDetail.ChargeCode == Constants.PrepaidChargeCode ? - flatCargoLineItemDetail.DetailsISCPercentage : flatCargoLineItemDetail.DetailsISCPercentage ; allAddonCharges.Add(addonCharges); allAddonChargesAmount += flatCargoLineItemDetail.DetailsISCAllowed; //allISCAmount += flatCargoFileLineItem.DetailsISCAllowed; } if (flatCargoLineItemDetail.DetailsOtherChargesAllowed != 0) { AddOnCharges addonCharges = new AddOnCharges(); addonCharges.AddOnChargeName = "OtherChargesAllowed"; addonCharges.AddOnChargeAmount = flatCargoLineItemDetail.DetailsOtherChargesAllowed; allAddonCharges.Add(addonCharges); allAddonChargesAmount += flatCargoLineItemDetail.DetailsOtherChargesAllowed; //allOtherChargesAmount += flatCargoFileLineItem.DetailsOtherChargesAllowed; } if (allAddonCharges.Count > 0) lineItemDetail.AddOnCharges = allAddonCharges.ToArray(); #endregion lineItemDetail.TotalNetAmount = flatCargoLineItemDetail.DetailsValuationChargeAmount + flatCargoLineItemDetail.DetailsWeightChargeAmount + allAddonChargesAmount; lineItemDetail.TotalNetAmountSpecified = true; #region AWB DATA //---------------------------------------------------------------- //--AirWaybill Data //---------------------------------------------------------------- AirWaybillDetails awbDetails = new AirWaybillDetails(); awbDetails.AWBDate = string.Format("{0:yyyy-MM-dd}", flatCargoLineItemDetail.AWBDate); awbDetails.AWBIssuingAirline = flatCargoLineItemDetail.AWBIssuingAirline.ToString(); awbDetails.AWBSerialNumber = flatCargoLineItemDetail.AWBSerialNumber.ToString(); awbDetails.AWBCheckDigit = flatCargoLineItemDetail.AWBCheckDigit.ToString(); awbDetails.OriginAirportCode = flatCargoLineItemDetail.OriginAirportCode; awbDetails.DestinationAirportCode = flatCargoLineItemDetail.DestinationAirportCode; awbDetails.FromAirportCode = flatCargoLineItemDetail.FromAirportCode; awbDetails.ToAirportOrPointOfTransferCode = flatCargoLineItemDetail.ToAirportOrPointOfTransferCode; awbDetails.DateOfCarriageOrTransfer = string.Format("{0:yyyy-MM-dd}", flatCargoLineItemDetail.DateOfCarriageOrTransfer); awbDetails.CurrAdjustmentIndicator = flatCargoLineItemDetail.CurrAdjustmentIndicator; lineItemDetail.AirWaybillDetails = awbDetails; #endregion //add LineItem to allLineItems collection return lineItemDetail; }
/// <summary> /// Returns a lineItemDetail for a Rejection Memo /// </summary> /// <param name="lineItemDetails"></param> /// <param name="lineItemNo"></param> /// <param name="lineItemDetailNo"></param> /// <param name="batchSequenceNumber"></param> /// <param name="recordSequenceWithinBatch"></param> /// <returns></returns> private LineItemDetail GetLineItemDetail(List<FlatRejectionRecord> lineItemDetails, int lineItemNo, int lineItemDetailNo, int batchSequenceNumber, int recordSequenceWithinBatch) { LineItemDetail lineItemDetail = new LineItemDetail(); lineItemDetail.DetailNumber = (lineItemDetailNo + 1).ToString(); lineItemDetail.LineItemNumber = (lineItemNo + 1).ToString(); lineItemDetail.BatchSequenceNumber = batchSequenceNumber.ToString(); lineItemDetail.RecordSequenceWithinBatch = recordSequenceWithinBatch.ToString(); lineItemDetail.RejectionMemoDetails = GetRejectionMemoDetails(lineItemDetails); lineItemDetail.ChargeAmount = new ChargeAmount[] { new ChargeAmount(){ Name = ChargeAmountName.WeightBilled, NameSpecified=true, Value = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.ChargeAmount where ccc.Name == ChargeAmountName.WeightBilled select ccc.Value).FirstOrDefault()).Sum() }, new ChargeAmount(){ Name = ChargeAmountName.WeightAccepted , NameSpecified=true, Value = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.ChargeAmount where ccc.Name == ChargeAmountName.WeightAccepted select ccc.Value).FirstOrDefault()).Sum() }, new ChargeAmount(){ Name = ChargeAmountName.WeightDifference, NameSpecified=true, Value = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.ChargeAmount where ccc.Name == ChargeAmountName.WeightDifference select ccc.Value).FirstOrDefault()).Sum() }, new ChargeAmount(){ Name = ChargeAmountName.ValuationBilled, NameSpecified=true, Value = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.ChargeAmount where ccc.Name == ChargeAmountName.ValuationBilled select ccc.Value).FirstOrDefault()).Sum() }, new ChargeAmount(){ Name = ChargeAmountName.ValuationAccepted, NameSpecified=true, Value = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.ChargeAmount where ccc.Name == ChargeAmountName.ValuationAccepted select ccc.Value).FirstOrDefault()).Sum() }, new ChargeAmount(){ Name = ChargeAmountName.ValuationDifference, NameSpecified=true, Value = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.ChargeAmount where ccc.Name == ChargeAmountName.ValuationDifference select ccc.Value).FirstOrDefault()).Sum() } }; lineItemDetail.AddOnCharges = new AddOnCharges[]{ new AddOnCharges(){AddOnChargeName = "ISCAllowed", AddOnChargeAmount = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select (from ccc in cc.AddOnCharges where ccc.AddOnChargeName =="ISCAllowed" select ccc.AddOnChargeAmount).FirstOrDefault()).Sum()}, new AddOnCharges(){AddOnChargeName = "ISCAccepted", AddOnChargeAmount = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select(from ccc in cc.AddOnCharges where ccc.AddOnChargeName =="ISCAccepted" select ccc.AddOnChargeAmount).FirstOrDefault()).Sum()}, new AddOnCharges(){AddOnChargeName = "ISCDifference", AddOnChargeAmount = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select(from ccc in cc.AddOnCharges where ccc.AddOnChargeName =="ISCDifference" select ccc.AddOnChargeAmount).FirstOrDefault()).Sum()}, new AddOnCharges(){AddOnChargeName = "OtherChargesAllowed", AddOnChargeAmount = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select(from ccc in cc.AddOnCharges where ccc.AddOnChargeName =="OtherChargesAllowed" select ccc.AddOnChargeAmount).FirstOrDefault()).Sum()}, new AddOnCharges(){AddOnChargeName = "OtherChargesAccepted", AddOnChargeAmount = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select(from ccc in cc.AddOnCharges where ccc.AddOnChargeName =="OtherChargesAccepted" select ccc.AddOnChargeAmount).FirstOrDefault()).Sum()}, new AddOnCharges(){AddOnChargeName = "OtherChargesDifference", AddOnChargeAmount = (from cc in lineItemDetail.RejectionMemoDetails.AirWaybillBreakdown select(from ccc in cc.AddOnCharges where ccc.AddOnChargeName =="OtherChargesDifference" select ccc.AddOnChargeAmount).FirstOrDefault()).Sum()} }; lineItemDetail.TotalNetAmount = (from cc in lineItemDetail.ChargeAmount where cc.Name == ChargeAmountName.WeightDifference select cc.Value).FirstOrDefault() + (from cc in lineItemDetail.ChargeAmount where cc.Name == ChargeAmountName.ValuationDifference select cc.Value).FirstOrDefault() + (from cc in lineItemDetail.AddOnCharges where cc.AddOnChargeName == "ISCDifference" select cc.AddOnChargeAmount).FirstOrDefault() + (from cc in lineItemDetail.AddOnCharges where cc.AddOnChargeName == "OtherChargesDifference" select cc.AddOnChargeAmount).FirstOrDefault(); lineItemDetail.TotalNetAmountSpecified = true; return lineItemDetail; }
public void SetSummaryListsFromInvoiceDetail(LineItemDetail lineItemDetail, InvoiceSummary invoice) { try { var flags = new ObservableCollection <SummaryViewSet>(); foreach (var eachFlag in lineItemDetail.Flagslist) { flags.Add(new SummaryViewSet() { Key = eachFlag.WarningInfo, SourceRight = (Constants.LineHigh.Equals(eachFlag.Priority) ? "ms-appx:///Assets/[email protected]" : (Constants.LineLow.Equals(eachFlag.Priority)) ? "ms-appx:///Assets/[email protected]" : "ms-appx:///Assets/[email protected]"), CellType = SummaryCellType.TwoColumnImageRight }); } if (flags.Count == 0) { flags.Add(new SummaryViewSet() { Key = string.Empty, Value2 = Constants.None, CellType = SummaryCellType.OneColumn }); } var notes = new ObservableCollection <SummaryViewSet>(); foreach (var a in lineItemDetail.NotesList) { notes.Add(new SummaryViewSet() { Key = Constants.Date, Value = a.CreatedTime, CellType = SummaryCellType.TwoColumn }); notes.Add(new SummaryViewSet() { Key = string.Empty, Value2 = a.Description, CellType = SummaryCellType.TwoColumn }); notes.Add(new SummaryViewSet() { Key = Constants.Owner, Value = a.Creator, CellType = SummaryCellType.TwoColumn }); } if (notes.Count == 0) { notes.Add(new SummaryViewSet() { Key = string.Empty, Value2 = Constants.None, CellType = SummaryCellType.OneColumn }); } var Taxes = new ObservableCollection <SummaryViewSet>(); foreach (var taxInfoKey in lineItemDetail.Taxlist.Keys) { var taxInfoList = lineItemDetail.Taxlist[taxInfoKey]; foreach (var taxInfo in taxInfoList) { Taxes.Add(new SummaryViewSet() { Key = string.Empty, Value2 = taxInfoKey, CellType = SummaryCellType.OneColumn }); Taxes.Add(new SummaryViewSet() { Key = Constants.TaxType, Value = taxInfo.TaxJurisdictionCode, CellType = SummaryCellType.TwoColumn }); Taxes.Add(new SummaryViewSet() { Key = Constants.TaxJurisdiction, Value = taxInfo.TaxTypeCode, CellType = SummaryCellType.TwoColumn }); Taxes.Add(new SummaryViewSet() { Key = Constants.TaxRate, Value = taxInfo.TaxRate, CellType = SummaryCellType.TwoColumn }); } } SummaryViewSet viewSet4 = new SummaryViewSet() { Key = Constants.Date, Value = lineItemDetail.Date, CellType = SummaryCellType.TwoColumn }; SummaryViewSet viewSet5 = new SummaryViewSet() { Key = Constants.Amount, Value = lineItemDetail.NetAmount, CellType = SummaryCellType.TwoColumn }; SummaryViewSet viewSet6 = new SummaryViewSet() { Key = Constants.TimeKeeper, Value = lineItemDetail.TimeKeeper, CellType = SummaryCellType.TwoColumn }; var summaryViewItems = new ObservableCollection <SummaryViewSet>(); summaryViewItems.Add(viewSet4); if (!string.IsNullOrWhiteSpace(lineItemDetail.TimeKeeper)) { summaryViewItems.Add(viewSet6); } summaryViewItems.Add(viewSet5); InvoiceSummaryViewItem item = new InvoiceSummaryViewItem(); item.Header = Constants.General; item.Symbol = ""; item.SummaryViewSets = summaryViewItems; var items = new ObservableCollection <InvoiceSummaryViewItem>(); items.Add(item); items.Add( new InvoiceSummaryViewItem() { Header = Constants.Narrative, Symbol = "", SummaryViewSets = new ObservableCollection <SummaryViewSet>() { new SummaryViewSet() { Key = string.Empty, Value2 = lineItemDetail.Narrative, CellType = SummaryCellType.OneColumn } } }); items.Add( new InvoiceSummaryViewItem() { Header = Constants.FirmVendorBilling, Symbol = "", SummaryViewSets = new ObservableCollection <SummaryViewSet>() { new SummaryViewSet() { Key = Constants.Task, Value = lineItemDetail.VendorTask, CellType = SummaryCellType.TwoColumn }, new SummaryViewSet() { Key = Constants.Activity, Value = lineItemDetail.VendorActivity, CellType = SummaryCellType.TwoColumn }, new SummaryViewSet() { Key = Constants.UnitHours, Value = lineItemDetail.VendorUnits, CellType = SummaryCellType.TwoColumn }, new SummaryViewSet() { Key = Constants.Rate, Value = lineItemDetail.VendorRate, CellType = SummaryCellType.TwoColumn }, new SummaryViewSet() { Key = Constants.VendorAdjustment, Value = lineItemDetail.VendorAdjustment, CellType = SummaryCellType.TwoColumn }, new SummaryViewSet() { Key = Constants.BilledTotal, Value = lineItemDetail.VendorBilledTotal, CellType = SummaryCellType.TwoColumn } } }); items.Add( new InvoiceSummaryViewItem() { Header = Constants.Flags, Symbol = "", SummaryViewSets = flags }); SummaryViewSet viewSet1 = new SummaryViewSet() { Key = Constants.ITPAdjustment, Value = lineItemDetail.ItpAdjustment, CellType = SummaryCellType.TwoColumn }; SummaryViewSet viewSet2 = new SummaryViewSet() { Key = Constants.ReviewerAdjustment, Value = lineItemDetail.ReviewerAdjustment, CellType = SummaryCellType.TwoColumn }; SummaryViewSet viewSet3 = new SummaryViewSet() { Key = Constants.NetTotal, Value = lineItemDetail.NetTotal, CellType = SummaryCellType.TwoColumn }; var summaryViewSets = new ObservableCollection <SummaryViewSet>(); summaryViewSets.Add(viewSet1); summaryViewSets.Add(viewSet2); summaryViewSets.Add(viewSet3); items.Add( new InvoiceSummaryViewItem() { Header = Constants.InHouseReview, Symbol = "", SummaryViewSets = summaryViewSets }); var adjustmentData = lineItemDetail.AdjustmentsList.GroupBy(adjustment => adjustment.GroupDescription); foreach (var adjustment in adjustmentData) { var adjustmentSet = new ObservableCollection <SummaryViewSet>(); foreach (var eachItem in adjustment) { adjustmentSet = AddSummaryViewData(eachItem, adjustmentSet); } items.Add( new InvoiceSummaryViewItem() { Header = adjustment.Key, Symbol = "", SummaryViewSets = adjustmentSet }); } if (lineItemDetail.AdjustmentsList.Count == 0) { var adjustments = new ObservableCollection <SummaryViewSet>(); adjustments.Add(new SummaryViewSet() { Key = string.Empty, Value2 = Constants.None, CellType = SummaryCellType.OneColumn }); items.Add( new InvoiceSummaryViewItem() { Header = Constants.Adjustments, Symbol = "", SummaryViewSets = adjustments }); } if (lineItemDetail.Permissions.Notes) { items.Add( new InvoiceSummaryViewItem() { Header = Constants.Notes, Symbol = "", SummaryViewSets = notes }); } if (Taxes.Count > 0) { items.Add( new InvoiceSummaryViewItem() { Header = Constants.Taxes, Symbol = "", SummaryViewSets = Taxes }); } invoice.InvoiceSummaryViewItemList = items; var index = 0; foreach (var summary in invoice.InvoiceSummaryViewItemList) { foreach (var viewSet in summary.SummaryViewSets) { viewSet.Index = index; index++; } } this.Invoice = invoice; } catch (T360Exception e) { string message = getMessages(e); ShowErrorMessage(message, Constants.InvoiceLineItemDetailFailed); if (T360ErrorCodes.NotInReviewerQueue.Equals(e.ErrorCodes[0].Code)) { Navigator.Navigate(Destination.InvoiceListView); } } catch (Exception ex) { string message = getMessages(ex); ShowErrorMessage(message, Constants.InvoiceLineItemDetailFailed); } }
public static BankcardTransactionPro SetBankCardTxnData(BankCardProProcessingOptions _BCPPO) { //Note : the following values aplly to the BankcardTransaction BankcardTransactionPro BCtransaction = new BankcardTransactionPro(); BankcardTransactionDataPro TxnData = new BankcardTransactionDataPro();//The following is necessary due to inheritance //The following are typical settings please ask your solution consultant if you have any questions TxnData.Amount = Convert.ToDecimal( (target.TxtAmount)); #region Ways to Convert to a decimal with two decimals //Note : Decimal Example please remember that the amount must always be two decimals "0.00" //decimal dAmount = 10; //TxnData.Amount = Convert.ToDecimal(dAmount); //TxnData.Amount = Decimal.Parse(TxnData.Amount.ToString("0.00")); //Or Simply //TxnData.Amount = Decimal.Parse(TxnData.Amount.ToString("0.00")); //Note : String Example please remember that the amount must always be two decimals "0.00" //string strAmount = "10"; //TxnData.Amount = Convert.ToDecimal(strAmount); //TxnData.Amount = Decimal.Parse(TxnData.Amount.ToString("0.00")); //Note : Int Example please remember that the amount must always be two decimals "0.00" //int intAmount = 10; //TxnData.Amount = Convert.ToDecimal(intAmount); //TxnData.Amount = Decimal.Parse(TxnData.Amount.ToString("0.00")); //Or //((int)(100 * amount)) * 0.01m; #endregion Ways to Convert to a decimal with two decimals if (target.TxtTip.Length > 0) if (Convert.ToDecimal(target.TxtTip) > 0) TxnData.TipAmount = Convert.ToDecimal(target.TxtTip); if (target.chkProcessAsPINDebitTxn)//Cashback for PINDebit only if (target.TxtCashBack.Length > 0) if (Convert.ToDecimal(target.TxtCashBack) > 0) TxnData.CashBackAmount = Convert.ToDecimal(target.TxtCashBack); TxnData.CurrencyCode = schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.TypeISOCurrencyCodeA3.USD; //Set below //try { TxnData.EntryMode = (schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.EntryMode)_ITV._EntryMode; } //catch { } try { TxnData.CustomerPresent = (schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.CustomerPresent)_ITV._CustomerPresent; } catch { } try { TxnData.SignatureCaptured = _ITV._SignatureCaptured; } catch { } //Used for Vantiv TxnData.TransactionDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"); //In the case of Retail or Restaurant //TxnData.TipAmount = 3.00M; // Used for QuasiCash transactions TxnData.IsQuasiCash = false; TxnData.LaneId = "1";//Used for Vantiv Tandem //Used for Retail/Restaurant/MOTO TxnData.EmployeeId = "123456"; //Used for Ecommerce/MOTO TxnData.OrderNumber = "123543"; //This values must be unique for each transaction. OrderNum should never be zero //TxnData.GoodsType = GoodsType.PhysicalGoods; //Check to see if partial approval should be allowed. To test a value of *.59 can be used if (target.ChkAllowPartialApprovals) TxnData.PartialApprovalCapable = schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.PartialApprovalSupportType.Capable; TxnData.TransactionDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"); // The below value is to support partial authorizations as mandated by Visa and Mastercard // First check to see if the service supports partial approvals, if it does then set the flag // that this transaction will support that partial approval. Remember to parse your Response.Amount to verify // the amount that was approved. Card Not Present applications do not need to abide by the partial approval mandate if (target._bcs.Tenders.PartialApprovalSupportType == schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.SvcInfo.PartialApprovalSupportType.Enabled) TxnData.PartialApprovalCapable = schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.PartialApprovalSupportType.Capable; BCtransaction.CustomerData = new TransactionCustomerData(); BCtransaction.CustomerData.CustomerId = TxnData.OrderNumber; BCtransaction.TenderData = new BankcardTenderData(); BCtransaction.TenderData.CardData = new CardData(); //Process as a Swipe or as a Keyed Transaction if (target.ChkCardNotPresent) {//Keyed Transaction TxnData.EntryMode = EntryMode.Keyed; BCtransaction.TenderData.CardData.CardType = (TypeCardType)target.CboCardTypes; BCtransaction.TenderData.CardData.Expire = target.TxtExpirationDate; // Note : that in a swipe track data the format is "YYMM" however here it's "MMYY" BCtransaction.TenderData.CardData.PAN = target.TxtPAN; BCtransaction.TenderData.CardData.CardholderName = "Dirk Pit"; } else if (target.ChkTokenization) {//Card tokenization try { TxnData.EntryMode = EntryMode.Keyed; TokenizedTransaction T = (TokenizedTransaction)target.CboTokenizedCard; BCtransaction.TenderData.CardData = new CardData(); BCtransaction.TenderData.PaymentAccountDataToken = T.PaymentAccountDataToken; BCtransaction.TenderData.CardData.CardType = T.CardType; BCtransaction.TenderData.CardData.Expire = T.ExpireationDate; // Note : that in a swipe track data the format is "YYMM" however here it's "MMYY" BCtransaction.TenderData.CardData.PAN = T.MaskedPAN; //It's recommended to set the masked PAN that was returned with the original token } catch { } } else if (target.ChkTrackDataFromMSR) {//Swiped Transaction #region Card Validation Samples (Optional however good reference for sending valid card swipes) //NOTE Example : In the case of processing a card swipe string use the following. //NOTE Example : The following will remove starting and ending sentenals BCtransaction.TenderData.CardData.CardType = (TypeCardType) target.CboCardTypes; string SwipeToSeperateTracks = target.TxtTrackDataFromMSR; TrackFromMSRSwipe TFMSRS = target.Helper.seperateTrackData(SwipeToSeperateTracks); string[] TrackProcessingOrder = ConfigurationManager.AppSettings["TxnData_OrderOfProcessingTracks"].Split('|'); foreach (string track in TrackProcessingOrder) { if (track == "Track1") if (target.Helper.validateTrackData(ref BCtransaction, TFMSRS.Track1Data)) { TxnData.EntryMode = EntryMode.TrackDataFromMSR; break; } if (track == "Track2") if (target.Helper.validateTrackData(ref BCtransaction, TFMSRS.Track2Data)) { TxnData.EntryMode = EntryMode.Track2DataFromMSR; break; } if (track == "Keyed") { DialogResult Result; Result = MessageBox.Show("Neither Track 1 nor Track 2 match. Process as a Keyed transaction instead?", "Process as Keyed", MessageBoxButtons.OKCancel); if (Result == DialogResult.Cancel) { Exception e = new Exception("Neither Track 1 or Track 2 is valid. Plesae swipe again"); throw e; } TxnData.EntryMode = EntryMode.Keyed; BCtransaction.TenderData.CardData.CardType = (TypeCardType)target.CboCardTypes; BCtransaction.TenderData.CardData.Expire = target.TxtExpirationDate; // Note : that in a swipe track data the format is "YYMM" however here it's "MMYY" BCtransaction.TenderData.CardData.PAN = target.TxtPAN; break; } } //Note : Other Track Examples (includes track 1 track 2 and an example of track 3) //MasterCard : %B5454545454545454^IPCOMMERCE/TESTCARD^1312101013490000000001000880000?;5454545454545454=13121010134988000010? //MasterCardPurchase : %B5480020605154711^IPCOMMERCE/TESTCARD^1312101100000001000000218000000?;5480020605154711=13121011000017026218? //MasterCardSigDebit : %B9999989900007723^IPCOMMERCE/TESTCARD^13121015432112345678?;9999989900007723=13121015432112345678? //Visa : %B4111111111111111^IPCOMMERCE/TESTCARD^13121010454500415000010?;4111111111111111=13121010454541500010? //Visa Purchasecard : %B4005765777003^IPCOMMERCE/TESTCARD^13121015432112345678?;4005765777003=13121015432112345678? //AmericanExpress : %B371449635398456^IPCOMMERCE/TESTCARD^1312060523319?;371449635398456=1312060523319? //Discover : %B6011000995504101^IPCOMMERCE/TESTCARD^13121011000627210201?;6011000995504101=13121011000627210201? //The following track includes a track 3 which is possible in Costco American Express cards %B371449635398456^IPCOMMERCE/TESTCARD^1312060523319?;371449635398456=1312060523319?+823156444000? #endregion Card Validation Samples (Optional however good reference for sending valid card swipes) } #region Simulating a flag used to set either AVS CV or PINDebit data //Simulating a flag used to set either AVS, CV data or PINDebit bool blnAVS = _ITV._IncludeAVS; bool blnCVV = _ITV._IncludeCV; if (blnAVS | blnCVV | target.chkProcessAsPINDebitTxn) { BCtransaction.TenderData.CardSecurityData = new CardSecurityData(); //Required if AVS or CV is used if (blnAVS) { //AVSData BCtransaction.TenderData.CardSecurityData.AVSData = new AVSData(); //Required AVS Elements BCtransaction.TenderData.CardSecurityData.AVSData.PostalCode = "80023"; //Optional AVS Elements BCtransaction.TenderData.CardSecurityData.AVSData.CardholderName = "John Smith"; BCtransaction.TenderData.CardSecurityData.AVSData.City = "Mason"; BCtransaction.TenderData.CardSecurityData.AVSData.Country = schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.TypeISOCountryCodeA3.USA; BCtransaction.TenderData.CardSecurityData.AVSData.Phone = "513 5456699"; //Must be of format "NNN NNNNNNN" BCtransaction.TenderData.CardSecurityData.AVSData.StateProvince = "OH"; BCtransaction.TenderData.CardSecurityData.AVSData.Street = "1234 IrwinSimpaon"; } if (blnCVV) { //CVData string strCVData = "111"; //Please note that this would typically be an input field in the application. if ((TypeCardType)target.CboCardTypes == TypeCardType.AmericanExpress) strCVData = "1111";//AVS has 4 numeric if (strCVData.Length > 0) { BCtransaction.TenderData.CardSecurityData.CVDataProvided = CVDataProvided.Provided; BCtransaction.TenderData.CardSecurityData.CVData = strCVData; } else { //In this case the card was present (Retail or Restaurant) however the CV code was not readable or available BCtransaction.TenderData.CardSecurityData.CVDataProvided = CVDataProvided.DeliberatelyBypass; } } //Check to see if the transaction is a PINDebit Transaction if (target.chkProcessAsPINDebitTxn) { BCtransaction.TenderData.CardSecurityData.KeySerialNumber = "1234567890123456"; BCtransaction.TenderData.CardSecurityData.PIN = "1234567890"; TxnData.AccountType = AccountType.CheckingAccount; } } #endregion END Simulating a flag used to set either AVS CV or PINDebit data #region Check to see if PINLessDebit selected if (target.ChkProcessAsPINLessDebit) { TxnData.PINlessDebitData = new PINlessDebitData(); TxnData.PINlessDebitData.PayeeData = new PayeeData(); TxnData.PINlessDebitData.PayeeData.AccountNumber = "000056"; TxnData.PINlessDebitData.PayeeData.CompanyName = "ABC Company"; TxnData.PINlessDebitData.PayeeData.Phone = "555 1238888"; } #endregion END Check to see if PINLessDebit selected //#region Simulating a flag used to set Magensa data ////Simulating a flag used to set either AVS, CV data or PINDebit //bool blnMagensa = false; //try { blnMagensa = Convert.ToBoolean(ConfigurationManager.AppSettings["TxnData_ProcessMagensaTxn"]); } //catch { }; //if (blnMagensa) //{ //*** ToDo : the following are generic values which will only work against Sandbox.*** // //First set the CardData to null // BCtransaction.TenderData.CardData = null; // if (BCtransaction.TenderData.CardSecurityData == null) { BCtransaction.TenderData.CardSecurityData = new CardSecurityData(); } // BCtransaction.TenderData.CardSecurityData.CVData = null; // BCtransaction.TenderData.CardSecurityData.CVDataProvided = CVDataProvided.NotSet; // BCtransaction.TenderData.CardSecurityData.IdentificationInformation = "A52AFB9FB5B283A6C8C38377A6CB1D2C63CC59D3B0B29D2A0DF1C9A54F123D37536756C77B4A9B75E51BF028B51971E81C8B221533A3AFF4"; // BCtransaction.TenderData.SecurePaymentAccountData = "13A7783BD91D0A05712606644778CF8F34397EAC2AB26676A52A380350CAA07E"; // BCtransaction.TenderData.EncryptionKeyId = "9011400B042692000398"; // BCtransaction.TenderData.SwipeStatus = "1065057"; // TxnData.ScoreThreshold = ".5"; // TxnData.EntryMode = EntryMode.Track2DataFromMSR; // TxnData.Reference = "11"; //} //#endregion Simulating a flag used to set Magensa data #region Pro specific functionality //Note : BankcardTransactionPro //The following sections are specific to the Pro object //Applications that will support Level 2, Level 3, and Managed Billing (recurring/installment payments) data may be //required to provide the following data elements in addition to the Base Transaction and Bankcard //Transaction data elements described above. if (Convert.ToBoolean(ConfigurationManager.AppSettings["ProcessAsBankcardTransaction_Pro"]) | _BCPPO != null)//Determines if additional Pro objects should be used. { PurchaseCardLevel PCL; bool InterchangeData; bool L2L3; if (_BCPPO != null) {//In this case an override was passed in PCL = _BCPPO.PurchaseCardLevel; InterchangeData = _BCPPO.InterchangeData; L2L3 = _BCPPO.IncludeLevel2OrLevel3Data; } else {//Use the default values in the app.config PCL = (PurchaseCardLevel)Enum.Parse(typeof(PurchaseCardLevel), ConfigurationManager.AppSettings["Pro_PurchaseCardLevel"]); InterchangeData = Convert.ToBoolean(ConfigurationManager.AppSettings["Pro_InterchangeData"]); L2L3 = Convert.ToBoolean(ConfigurationManager.AppSettings["Pro_IncludeLevel2OrLevel3Data"]); } #region Purchase Card Level 2 or Level 3 if (PCL == PurchaseCardLevel.Level2 | PCL == PurchaseCardLevel.Level3) { /* For AuthorizeAndCapture the level2/3 goes in immediately as there is no follow up transaction. For Authorize followed by Capture the level 2/3 goes in the Capture, never in the Authorize. The schema requires BaseAmt and OrderNum for level 2. Amt, Quantity, SeqNum, TaxIncludedInd, and UnitPrice are all required for level 3. • Of course you must have level 2 in order to have level 3. Set TxnData.CmrclCardReq to “Enable” since some providers get that value and will return the card type in the response in CmrclCardResp. Not all providers do this but they should always set it. The value is returned in the response and can be used to determine whether or not to submit level 2. Level 2 requirements for Ecomm/Moto: • TaxExempt • DestinationPostal • ShipFromPostalCode Level 2 requirements for Retail: • DestinationPostal • TaxExempt Level 3 requirements for Ecomm/Moto: • Desc • ProductCode • UnitOfMeasure • only 98 items allowed */ //Send with the original Authorize with the "RequestCommerciaCard" flag set. In the response you will reference //"CommercialCardResponse" as the indicator that the card is a valid Level 2 or Level 3 card. BCtransaction.InterchangeData = new BankcardInterchangeData(); BCtransaction.InterchangeData.RequestCommercialCard = RequestCommercialCard.Enable; if (L2L3 & PCL == PurchaseCardLevel.Level2) {//Level 2 data TxnData.Level2Data = SetLevel2Data(); if (BCtransaction.TenderData.CardData.CardType == TypeCardType.AmericanExpress) { BCtransaction.CustomerData = new TransactionCustomerData(); BCtransaction.CustomerData.ShippingData = new CustomerInfo(); BCtransaction.CustomerData.ShippingData.Name = new NameInfo(); BCtransaction.CustomerData.ShippingData.Address = new schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.AddressInfo(); //For Amex only cards. Amex only supports Purchase Card Level 2 BCtransaction.CustomerData.ShippingData.Name.First = "Dan"; //Full name or parameterized name. BCtransaction.CustomerData.ShippingData.Name.Middle = "Joe"; BCtransaction.CustomerData.ShippingData.Name.Last = "Billings"; BCtransaction.CustomerData.ShippingData.Address.Street1 = "123 HappyWay"; //BCtransaction.CustomerData.ShippingData.Address.Street2 = ""; BCtransaction.CustomerData.ShippingData.Address.City = "Mason"; BCtransaction.CustomerData.ShippingData.Address.StateProvince = "OH"; BCtransaction.CustomerData.ShippingData.Address.PostalCode = "45040"; BCtransaction.CustomerData.ShippingData.Address.CountryCode = schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.TypeISOCountryCodeA3.USA; } } if (L2L3 & PCL == PurchaseCardLevel.Level3) {//Level 3 data TxnData.Level2Data = SetLevel2Data(); //Level 3 data includes Level 2 data plus line items details. in this case your application should handle calling the following // for each line item List<LineItemDetail> LIDs = new List<LineItemDetail>(); LineItemDetail LID = new LineItemDetail(); LID = SetLevel3Data(); LIDs.Add(LID); TxnData.LineItemDetails = LIDs; } } #endregion Purchase Card Level 2 or Level 3 #region Recurring/Bill Payments if (InterchangeData) { BCtransaction.InterchangeData = new BankcardInterchangeData(); //Single Payment BCtransaction.InterchangeData.BillPayment = BillPayment.SinglePayment; BCtransaction.InterchangeData.ExistingDebt = ExistingDebt.IsExistingDebt; /* //Deferred Billing BCtransaction.InterchangeData.BillPayment = BillPayment.DeferredBilling; BCtransaction.InterchangeData.ExistingDebt = ExistingDebt.IsExistingDebt; //Installment BCtransaction.InterchangeData.BillPayment = BillPayment.Installment; BCtransaction.InterchangeData.ExistingDebt = ExistingDebt.IsExistingDebt; BCtransaction.InterchangeData.CurrentInstallmentNumber = 1; BCtransaction.InterchangeData.TotalNumberOfInstallments = 3; */ //Recurring //Note: Any time recurring payments are used for any BCP service MultiClearSeqNum should be 1 for the first payment and any number //greater than 1 for the additional recurring payments. The software company doesn’t have to count payments. //They can always send 2 for the additional transactions if they want. Sending the 1 sends a code to the service provider that this //is the first payment and CVData and AVSData are expected. Sending greater than 1 means that the lack of CVData and AVSData is OK //since they don’t have to store or submit that data with the additional payments. BCtransaction.InterchangeData.BillPayment = BillPayment.Recurring; BCtransaction.InterchangeData.ExistingDebt = ExistingDebt.IsExistingDebt; BCtransaction.InterchangeData.CurrentInstallmentNumber = 1; //If this is a follow-up recuring payment the value needs to be greater than 1. //Any time BillPayInd is set to either “Deferred_Billing”, “Installment” or “Recurring”, CustPresentFlag should be set to “Bill_Payment" if (BCtransaction.InterchangeData.BillPayment == BillPayment.DeferredBilling | BCtransaction.InterchangeData.BillPayment == BillPayment.Installment | BCtransaction.InterchangeData.BillPayment == BillPayment.Recurring) TxnData.CustomerPresent = schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.CustomerPresent.BillPayment; } #endregion Recurring/Bill Payments } #endregion END-Pro specific functionality #region Verified By Visa (VbV/VPAS) bool blnVPAS = false; try { blnVPAS = Convert.ToBoolean(ConfigurationManager.AppSettings["TxnData_IncludeVPAS"]); } catch { }; /* IF supported If a token is obtained: TenderData/EcommerceSecurityData/TokenData is required and contains the token provided by the service. TenderData/EcommerceSecurityData/TokenInd is required and must be set to VPAS_3D_Secure_V100 or VPAS_3D_Secure_V102. Even if the merchant has a newer version, either setting will work for any version. TxnData/EcommerceData/PayTypeInd is required and must be set to Secure_Ecom. TenderData/EcommerceSecurityData/XID is optional and may contain the Visa XID value. If VbV is supported but the token could not be obtained: TenderData/EcommerceSecurityData/TokenData will not be populated. TenderData/EcommerceSecurityData/TokenInd is required and must be set to Attempted_Card_Unsupported or Attempted_Service_Unavailable. TxnData/EcommerceData/PayTypeInd is required and must be set to Non_authenticated_Security_Without_SSL or Non_authenticated_Security_With_SSL. */ if (blnVPAS && BCtransaction.TenderData.CardData.CardType == TypeCardType.Visa) { //Token Obtained BCtransaction.TenderData.EcommerceSecurityData.TokenData = ""; BCtransaction.TenderData.EcommerceSecurityData.TokenIndicator = TokenIndicator.VPAS; //TODO :TxnData. BCtransaction.TenderData.EcommerceSecurityData.XID = ""; //No Token Obtained BCtransaction.TenderData.EcommerceSecurityData.TokenIndicator = TokenIndicator.AttemptedCardUnsupported; //TODO :TxnData. } #endregion Verified By Visa (VbV/VPAS) #region MasterCard Secure Code (MCSC/UCAF) bool blnUCAF = false; try { blnUCAF = Convert.ToBoolean(ConfigurationManager.AppSettings["TxnData_IncludeUCAF"]); } catch { }; /* * If a token is obtained: TenderData/EcommerceSecurityData/TokenData is required and contains the token provided by the service. TenderData/EcommerceSecurityData/TokenInd is required and must be set to UCAF or UCAF_With_Data. TxnData/EcommerceData/PayTypeInd is required and must be set to Secure_Ecom. If MCSC is supported but the token could not be obtained or will not be sent with the transaction: TenderData/EcommerceSecurityData/TokenData will not be populated. TenderData/EcommerceSecurityData/TokenInd is required and must be set to Attempted_Card_Unsupported, Attempted_Service_Unavailable, or UCAF_Without_Data. TxnData/EcommerceData/PayTypeInd is required and must be set to either Non_authenticated_Security_Without_SSL or Non_authenticated_Security_With_SSL. */ if (blnUCAF && BCtransaction.TenderData.CardData.CardType == TypeCardType.MasterCard) { //Token Obtained BCtransaction.TenderData.EcommerceSecurityData.TokenData = ""; BCtransaction.TenderData.EcommerceSecurityData.TokenIndicator = TokenIndicator.UCAFWithData; //TODO :TxnData. BCtransaction.TenderData.EcommerceSecurityData.XID = ""; //No Token Obtained BCtransaction.TenderData.EcommerceSecurityData.TokenIndicator = TokenIndicator.AttemptedCardUnsupported; //TODO :TxnData. } #endregion MasterCard Secure Code (MCSC/UCAF) # region Convenience Fees //Simulating a flag used to include Convenience Fees bool cFees = false; try { cFees = Convert.ToBoolean(ConfigurationManager.AppSettings["TxnData_IncludeCFees"]); } catch { }; if (cFees) { //TxnData.FeeAmount = 5.00M; } # endregion Convenience Fees #region Soft Descriptors //Simulating setting soft descriptors try { if (Convert.ToBoolean(ConfigurationManager.AppSettings["TxnData_SoftDescriptors"])) { TxnData.AlternativeMerchantData = target.Helper.SetSoftDescriptors(); } } catch { }; #endregion Soft Descriptors BCtransaction.TransactionData = TxnData; return BCtransaction; }
public static LineItemDetail SetLevel3Data() { LineItemDetail LID = new LineItemDetail(); LID.Amount = 2.00M; //Required : Line item total cost. See DiscountInd and TaxInd to determine whether this amount is inclusive of DiscountAmt and Tax. LID.CommodityCode = "123456789012"; //Optional : Line item commodity code. LID.Description = "PartXYZ"; //Optional : Line item description. LID.DiscountAmount = 1.00M; //Optional : Discount amount for this line item. LID.DiscountIncluded = true; //Conditional : Indicates whether Amt is inclusive of discount. Conditional, required if DiscountAmt is specified. LID.ProductCode = "xyz123"; //Optional : Line item product code. LID.Quantity = 1.00M; //Required : Quantity of item. schemas.ipcommerce.com.Ipc.General.WCF.Contracts.Common.External.Txn.Tax tx = new Tax(); tx.Amount = 0.15M; //Required : Total amount of tax applied. tx.InvoiceNumber = "IONum"; //Optional : Tax invoice number. //List<ItemizedTax> ITxs = new List<ItemizedTax>(); //Optional : Collection of itemized tax information. //ItemizedTax ITX = new ItemizedTax(); //ITX.Amount = 0.05M; //Required : Amount of specified tax applied. //ITX.Rate = 0.02M; //Optional : Rate for tax specified. //ITX.Type = TypeTaxType.StateSalesTax; //Required : Type of tax specified. //ITxs.Add(ITX); LID.Tax = tx; LID.TaxIncluded = true;//Required: Specifies whether Amt is inclusive of tax. LID.UnitOfMeasure = TypeUnitOfMeasure.Ounce; //Optional : Units used to measure quantity. LID.UnitPrice = 0.80M; //Required : Price per unit of line item. LID.UPC = "UPC123"; //Optional : Line item UPC code. return LID; }