예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PaymentProfile"/> class, using the passed-in API type to create the profile.
        /// </summary>
        /// <param name="apiType">Type of the API.</param>
        public PaymentProfile(customerPaymentProfileMaskedType apiType)
        {
            if(apiType.billTo!=null)
                this.BillingAddress = new Address(apiType.billTo);

            this.ProfileID = apiType.customerPaymentProfileId;

            if (apiType.driversLicense!=null) {
                this.DriversLicenseNumber = apiType.driversLicense.number;
                this.DriversLicenseState = apiType.driversLicense.state;
                this.DriversLicenseDOB = apiType.driversLicense.dateOfBirth;
            }

            if (apiType.customerTypeSpecified) {
                this.IsBusiness = apiType.customerType == customerTypeEnum.business;
            } else {
                this.IsBusiness = false;
            }

            if (apiType.payment != null) {
                var card = (creditCardMaskedType)apiType.payment.Item;
                this.CardType = card.cardType;
                this.CardNumber = card.cardNumber;
                this.CardExpiration = card.expirationDate;
            }
            this.TaxID = apiType.taxId;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PaymentProfile"/> class, using the passed-in API type to create the profile.
        /// </summary>
        /// <param name="apiType">Type of the API.</param>
        public PaymentProfile(customerPaymentProfileMaskedType apiType) {
            
            if(apiType.billTo!=null)
                this.BillingAddress = new Address(apiType.billTo);
            
            this.ProfileID = apiType.customerPaymentProfileId;
            
            if (apiType.driversLicense!=null) {
                this.DriversLicenseNumber = apiType.driversLicense.number;
                this.DriversLicenseState = apiType.driversLicense.state;
                this.DriversLicenseDOB = apiType.driversLicense.dateOfBirth;
            }

            if (apiType.customerTypeSpecified) {
                this.IsBusiness = apiType.customerType == customerTypeEnum.business;
            } else {
                this.IsBusiness = false;
            }

            if (apiType.payment != null)
            {
                if (apiType.payment.Item is creditCardMaskedType)
                {
                    var card = (creditCardMaskedType) apiType.payment.Item;
                    this.CardType = card.cardType;
                    this.CardNumber = card.cardNumber;
                    this.CardExpiration = card.expirationDate;
                }
                else if (apiType.payment.Item is bankAccountMaskedType)
                {
                    var bankAcct = (bankAccountMaskedType)apiType.payment.Item;
                    this.eCheckBankAccount = new BankAccount()
                        {
                            accountTypeSpecified = bankAcct.accountTypeSpecified,
                            accountType = (BankAccountType)Enum.Parse(typeof(BankAccountType), bankAcct.accountType.ToString(), true),
                            routingNumber = bankAcct.routingNumber,
                            accountNumber = bankAcct.accountNumber,
                            nameOnAccount = bankAcct.nameOnAccount,
                            echeckTypeSpecified = bankAcct.echeckTypeSpecified,
                            echeckType = (EcheckType)Enum.Parse(typeof(EcheckType), bankAcct.echeckType.ToString(), true),
                            bankName = bankAcct.bankName,
                            checkNumber = ""
                        };
                }
            }
            this.TaxID = apiType.taxId;
        }