コード例 #1
0
        public virtual IEnumerable VoidCCPayment(PXAdapter adapter)
        {
            var        methodName = GetClassMethodName();
            AccessInfo info       = this.Base.Accessinfo;

            PXTrace.WriteInformation($"{methodName} started.");
            List <TPrimary> list = new List <TPrimary>();

            foreach (TPrimary doc in adapter.Get <TPrimary>())
            {
                CheckDocumentUpdatedInDb(doc);
                PXCache cache = this.Base.Caches[typeof(TPrimary)];
                bool    prevAllowUpdateState = cache.AllowUpdate;
                cache.AllowUpdate = true;
                ICCPayment pDoc = GetPaymentDoc(doc);
                PXTrace.WriteInformation($"{methodName}. RefNbr:{pDoc.RefNbr}; UserName:{info.UserName}");
                list.Add(doc);
                BeforeVoidPayment(doc);
                var            tranAdapter      = new GenericExternalTransactionAdapter <ExternalTransactionDetail>(ExternalTransaction);
                var            afterVoidActions = GetAfterVoidActions();
                CCPaymentEntry paymentEntry     = GetCCPaymentEntry();
                foreach (var item in afterVoidActions)
                {
                    paymentEntry.AddAfterProcessCallback(item);
                }
                if (ReleaseAfterVoid)
                {
                    paymentEntry.AddAfterProcessCallback(ReleaseARDocument);
                }
                paymentEntry.VoidCCPayment(pDoc, tranAdapter);
                cache.AllowUpdate = prevAllowUpdateState;
            }
            return(list);
        }
コード例 #2
0
        public virtual IEnumerable CaptureOnlyCCPayment(PXAdapter adapter)
        {
            var methodName = GetClassMethodName();

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

            if (parameters == null)
            {
                return(adapter.Get());
            }
            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);
                }
                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);
                BeforeCaptureOnlyPayment(doc);
                var            tranAdapter  = new GenericExternalTransactionAdapter <ExternalTransactionDetail>(ExternalTransaction);
                var            afterActions = GetAfterCaptureOnlyActions();
                CCPaymentEntry paymentEntry = GetCCPaymentEntry();
                foreach (var item in afterActions)
                {
                    paymentEntry.AddAfterProcessCallback(item);
                }
                if (ReleaseAfterCaptureOnly)
                {
                    paymentEntry.AddAfterProcessCallback(ReleaseARDocument);
                }
                paymentEntry.CaptureOnlyCCPayment(parameters, pDoc, tranAdapter);
            }
            return(list);
        }
コード例 #3
0
        public virtual IEnumerable CreditCCPayment(PXAdapter adapter)
        {
            var        methodName = GetClassMethodName();
            AccessInfo info       = this.Base.Accessinfo;

            PXTrace.WriteInformation($"{methodName} started.");
            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);
                BeforeCreditPayment(doc);
                var tranAdapter = new GenericExternalTransactionAdapter <ExternalTransactionDetail>(ExternalTransaction);
                if (String.IsNullOrEmpty(pDoc.RefTranExtNbr))
                {
                    PaymentDoc.Cache.RaiseExceptionHandling <Payment.refTranExtNbr>(pDoc, pDoc.RefTranExtNbr, new PXSetPropertyException(AR.Messages.ERR_PCTransactionNumberOfTheOriginalPaymentIsRequired));
                    continue;
                }

                var            afterCreditActions = GetAfterCreditActions();
                CCPaymentEntry paymentEntry       = GetCCPaymentEntry();
                foreach (var item in afterCreditActions)
                {
                    paymentEntry.AddAfterProcessCallback(item);
                }
                if (ReleaseAfterCredit)
                {
                    paymentEntry.AddAfterProcessCallback(ReleaseARDocument);
                }
                paymentEntry.CreditCCPayment(pDoc, tranAdapter);
            }
            return(list);
        }