示例#1
0
        public virtual void initAuthCCInfo(PXGraph aGraph, string ViewName)
        {
            InputPaymentInfo filter = InputPaymentInfo.Current;

            filter.PCTranNumber = filter.AuthNumber = null;
            PXUIFieldAttribute.SetVisible <InputPaymentInfo.pCTranNumber>(InputPaymentInfo.Cache, filter, false);
        }
示例#2
0
        public virtual void clearCCInfo()
        {
            InputPaymentInfo filter = InputPaymentInfo.Current;

            filter.PCTranNumber = filter.AuthNumber = null;
        }
示例#3
0
        public virtual IEnumerable RecordCCPayment(PXAdapter adapter)
        {
            var methodName = GetClassMethodName();

            PXTrace.WriteInformation($"{methodName} started.");
            AccessInfo       info       = this.Base.Accessinfo;
            InputPaymentInfo parameters = InputPaymentInfo.Current;

            if (parameters == null)
            {
                return(adapter.Get());
            }
            bool failed = false;

            if (string.IsNullOrEmpty(parameters.PCTranNumber))
            {
                if (InputPaymentInfo.Cache.RaiseExceptionHandling <InputPaymentInfo.pCTranNumber>(parameters,
                                                                                                  null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(InputPaymentInfo.pCTranNumber).Name)))
                {
                    throw new PXRowPersistingException(typeof(InputPaymentInfo.pCTranNumber).Name, null, ErrorMessages.FieldIsEmpty, typeof(InputPaymentInfo.pCTranNumber).Name);
                }
                failed = true;
            }

            if (string.IsNullOrEmpty(parameters.AuthNumber))
            {
                if (InputPaymentInfo.Cache.RaiseExceptionHandling <InputPaymentInfo.authNumber>(parameters,
                                                                                                null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(InputPaymentInfo.authNumber).Name)))
                {
                    throw new PXRowPersistingException(typeof(InputPaymentInfo.authNumber).Name, null, ErrorMessages.FieldIsEmpty, typeof(InputPaymentInfo.authNumber).Name);
                }
                failed = true;
            }
            if (failed)
            {
                return(adapter.Get());
            }

            List <TPrimary> list = new List <TPrimary>();

            foreach (TPrimary doc in adapter.Get <TPrimary>())
            {
                CheckDocumentUpdatedInDb(doc);
                ICCPayment pDoc = GetPaymentDoc(doc);
                PXTrace.WriteInformation($"{methodName}. RefNbr:{pDoc.RefNbr}; UserName:{info.UserName}");
                list.Add(doc);
                BeforeRecordPayment(doc);

                var            tranAdapter  = new GenericExternalTransactionAdapter <ExternalTransactionDetail>(ExternalTransaction);
                var            afterActions = GetAfterRecordActions();
                CCPaymentEntry paymentEntry = GetCCPaymentEntry();
                foreach (var item in afterActions)
                {
                    paymentEntry.AddAfterProcessCallback(item);
                }
                if (ReleaseAfterRecord)
                {
                    paymentEntry.AddAfterProcessCallback(ReleaseARDocument);
                }
                if (pDoc.DocType == ARDocType.Payment || pDoc.DocType == ARDocType.Prepayment)
                {
                    paymentEntry.RecordCCpayment(pDoc, InputPaymentInfo.Current, tranAdapter);
                }
                else if (pDoc.DocType == ARDocType.Refund)
                {
                    paymentEntry.RecordCCCredit(pDoc, InputPaymentInfo.Current, tranAdapter);
                }
            }
            return(list);
        }