예제 #1
0
        internal List <string> ProcessValidationResult(string json)
        {
            var response         = JsonDoc.Parse(json);
            var validationErrors = new List <string>();

            MerchantInfo?.ProcessValidation(response, validationErrors);
            LegalInfo?.ProcessValidation(response, validationErrors);
            BusinessInfo?.ProcessValidation(response, validationErrors);

            // OPTIONALS
            Headquarters?.ProcessValidation(response, validationErrors);
            SalesMethods?.ProcessValidation(response, validationErrors);
            ProcessingMethod?.ProcessValidation(response, validationErrors);
            FutureDeliveryInfo?.ProcessValidation(response, validationErrors);
            GolfIndustry?.ProcessValidation(response, validationErrors);
            SalonIndustry?.ProcessValidation(response, validationErrors);
            LodgingResortInfo?.ProcessValidation(response, validationErrors);
            TransactionInfo?.ProcessValidation(response, validationErrors);
            EquipmentInfo?.ProcessValidation(response, validationErrors);
            ShippingOptions?.ProcessValidation(response, validationErrors);
            DepositOptions?.ProcessValidation(response, validationErrors);
            StatementOptions?.ProcessValidation(response, validationErrors);
            DisputeOptions?.ProcessValidation(response, validationErrors);

            // owners/officers
            for (int i = 0; i < 10; i++)
            {
                if (i < OwnerOfficers.Count)
                {
                    var owner = OwnerOfficers[i];
                    owner.Prefix = string.Format("OwnerOfficer{0}_", i + 1);
                    owner.ProcessValidation(response, validationErrors);
                }
                else
                {
                    continue;
                }
            }

            // banking info
            BankingInfo?.ProcessValidation(response, validationErrors);
            if (BankingInfo != null)
            {
                foreach (var account in BankingInfo.BankAccounts)
                {
                    account.Prefix = string.Format("MerchantAccount{0}_", BankingInfo.BankAccounts.IndexOf(account) + 1);
                    account.ProcessValidation(response, validationErrors);
                }
            }

            return(validationErrors);
        }
예제 #2
0
        internal MultipartForm BuildForm()
        {
            var form = new MultipartForm(false);

            PopulateForm(form, MerchantInfo);
            if (LegalInfoSameAsMerchant)
            {
                LegalInfo = new LegalInfo {
                    CorporateName         = MerchantInfo?.MerchantDbaName,
                    CorporateStreet       = MerchantInfo?.MerchantStreet,
                    CorporateCity         = MerchantInfo?.MerchantCity,
                    CorporateStatesSelect = MerchantInfo?.MerchantStatesSelect,
                    CorporateZip          = MerchantInfo?.MerchantZip
                };
            }
            PopulateForm(form, LegalInfo);
            PopulateForm(form, BusinessInfo);

            // OPTIONALS
            Headquarters?.PopulateForm(form);
            SalesMethods?.PopulateForm(form);
            ProcessingMethod?.PopulateForm(form);
            FutureDeliveryInfo?.PopulateForm(form);
            GolfIndustry?.PopulateForm(form);
            SalonIndustry?.PopulateForm(form);
            LodgingResortInfo?.PopulateForm(form);
            TransactionInfo?.PopulateForm(form);
            EquipmentInfo?.PopulateForm(form);
            ShippingOptions?.PopulateForm(form);
            DepositOptions?.PopulateForm(form);
            StatementOptions?.PopulateForm(form);
            DisputeOptions?.PopulateForm(form);

            // owners/officers
            for (int i = 0; i < 10; i++)
            {
                OwnerOfficer owner = new OwnerOfficer();
                if (i < OwnerOfficers.Count)
                {
                    owner = OwnerOfficers[i];
                }

                owner.Prefix = string.Format("OwnerOfficer{0}_", i + 1);
                PopulateForm(form, owner);

                // signers
                form.Set(string.Format("Signer{0}Email", i + 1), owner.EmailAddress ?? " ");
                form.Set(string.Format("Signer{0}FullName", i + 1), owner.FullName ?? " ");
            }

            // banking info
            PopulateForm(form, BankingInfo);
            if (BankingInfo != null)
            {
                foreach (var account in BankingInfo.BankAccounts)
                {
                    account.Prefix = string.Format("MerchantAccount{0}_", BankingInfo.BankAccounts.IndexOf(account) + 1);
                    account.PopulateForm(form);
                }
            }

            return(form);
        }