public static void DoDateUpdateProcess(CustomerPaymentMethod cpm)
        {
            CustomerPaymentMethodMaint cpmGraph = PXGraph.CreateInstance <CustomerPaymentMethodMaint>();

            cpmGraph.CustomerPaymentMethod.Current = cpm;
            CCCustomerInformationManager.SyncExistingPMI(cpmGraph, cpmGraph.CustomerPaymentMethod, cpmGraph.DetailsAll);
            cpm.ExpirationDate = cpmGraph.CustomerPaymentMethod.Current.ExpirationDate;
            if (cpm.ExpirationDate == null)
            {
                string formatString   = CCProcessingUtils.GetExpirationDateFormat(cpmGraph, cpm.CCProcessingCenterID);
                string responseString = null;
                foreach (PXResult <CustomerPaymentMethodDetail, PaymentMethodDetail> details in cpmGraph.DetailsAll.Select())
                {
                    PaymentMethodDetail         pmDetail  = details;
                    CustomerPaymentMethodDetail cpmDetail = details;
                    if (pmDetail.IsExpirationDate == true)
                    {
                        responseString = cpmDetail.Value;
                        break;
                    }
                }
                throw new PXException(Messages.ExpDateParseFailed, InterfaceConstants.ExpDateFormatDesc, responseString, formatString);
            }
            cpmGraph.Save.Press();
        }
Beispiel #2
0
 public virtual IEnumerable UpdateExpirationDate(PXAdapter adapter)
 {
     if (ProcessingCenter.Current != null)
     {
         CCProcessingCenter row = ProcessingCenter.Current;
         if (string.IsNullOrEmpty(CCProcessingUtils.GetExpirationDateFormat(this, row.ProcessingCenterID)))
         {
             ICCPaymentProcessing processor = this.CreateAndInitProcessor(row);
             this.ImportExpDateFromPC(processor);
             this.Save.Press();
         }
         CCUpdateExpirationDatesProcess updateGraph = PXGraph.CreateInstance <CCUpdateExpirationDatesProcess>();
         updateGraph.Filter.Current = new CCUpdateExpirationDatesProcess.CPMFilter()
         {
             ProcessingCenterID = row.ProcessingCenterID
         };
         throw new PXRedirectRequiredException(updateGraph, true, "UpdateExpirationDate")
               {
                   Mode = PXBaseRedirectException.WindowMode.NewWindow
               };
     }
     return(adapter.Get());
 }