private void LoadFromJSON(JsonObject obj) { foreach (string key in obj.Keys) { switch (key) { case IdKey: Id = obj.GetJSONContentAsInt(key); break; case CustomerIdKey: _customerId = obj.GetJSONContentAsInt(key); break; case FirstNameKey: FirstName = obj.GetJSONContentAsString(key); break; case LastNameKey: LastName = obj.GetJSONContentAsString(key); break; case FullNumberKey: FullNumber = obj.GetJSONContentAsString(key); break; case ExpirationMonthKey: ExpirationMonth = obj.GetJSONContentAsInt(key); break; case ExpirationYearKey: ExpirationYear = obj.GetJSONContentAsInt(key); break; case CvvKey: _cvv = obj.GetJSONContentAsString(key); break; case BillingAddressKey: BillingAddress = obj.GetJSONContentAsString(key); break; case BillingAddress2Key: BillingAddress2 = obj.GetJSONContentAsString(key); break; case BillingCityKey: BillingCity = obj.GetJSONContentAsString(key); break; case BillingCountryKey: BillingCountry = obj.GetJSONContentAsString(key); break; case BillingStateKey: BillingState = obj.GetJSONContentAsString(key); break; case BillingZipKey: BillingZip = obj.GetJSONContentAsString(key); break; case BankNameKey: _bankName = obj.GetJSONContentAsString(key); break; case BankRoutingNumberKey: _bankRoutingNumber = obj.GetJSONContentAsString(key); break; case BankAccountNumberKey: _bankAccountNumber = obj.GetJSONContentAsString(key); break; case BankAccountTypeKey: _bankAccountType = obj.GetJSONContentAsEnum<BankAccountType>(key); break; case BankAccountHolderTypeKey: _bankAccountHolderType = obj.GetJSONContentAsEnum<BankAccountHolderType>(key); break; case PaymentMethodNonceKey: _paymentMethodNonce = obj.GetJSONContentAsString(key); break; case PayPalEmailKey: _payPalEmail = obj.GetJSONContentAsString(key); break; case PaymentTypeKey: _paymentType = obj.GetJSONContentAsEnum<PaymentProfileType>(key); break; case CardTypeKey: _cardType = obj.GetJSONContentAsString(key); break; case MaskedCardNumberKey: _maskedCardNumber = obj.GetJSONContentAsString(key); break; default: break; } } }
/// <summary> /// Load data from a JsonObject /// </summary> /// <param name="obj">The JsonObject containing subscription data</param> private void LoadFromJSON(JsonObject obj) { foreach (string key in obj.Keys) { switch (key) { case ActivatedAtKey: _activatedAt = obj.GetJSONContentAsDateTime(key); break; case CancellationMessageKey: _cancellationMessage = obj.GetJSONContentAsString(key); break; case CanceledAtKey: _canceledAt = obj.GetJSONContentAsDateTime(key); break; case ExpiresAtKey: _expiresAt = obj.GetJSONContentAsDateTime(key); break; default: break; } } }