PaymentLinkUpdateOptions.fromJson constructor
PaymentLinkUpdateOptions.fromJson(
- Object? json
Implementation
factory PaymentLinkUpdateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return PaymentLinkUpdateOptions(
active: map['active'] == null ? null : (map['active'] as bool),
afterCompletion: map['after_completion'] == null
? null
: PaymentLinkAfterCompletion.fromJson(map['after_completion']),
allowPromotionCodes: map['allow_promotion_codes'] == null
? null
: (map['allow_promotion_codes'] as bool),
automaticTax: map['automatic_tax'] == null
? null
: SessionAutomaticTax.fromJson(map['automatic_tax']),
billingAddressCollection: map['billing_address_collection'] == null
? null
: PaymentLinkBillingAddressCollection.fromJson(
map['billing_address_collection']),
customFields: map['custom_fields'] == null
? null
: (map['custom_fields'] as List<Object?>)
.map((el) => SessionCustomFieldsItem.fromJson(el))
.toList(),
customText: map['custom_text'] == null
? null
: SessionCustomText.fromJson(map['custom_text']),
customerCreation: map['customer_creation'] == null
? null
: PaymentLinkCustomerCreation.fromJson(map['customer_creation']),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
inactiveMessage: map['inactive_message'] == null
? null
: (map['inactive_message'] as String),
invoiceCreation: map['invoice_creation'] == null
? null
: PaymentLinkCreateOptionsInvoiceCreation.fromJson(
map['invoice_creation']),
lineItems: map['line_items'] == null
? null
: (map['line_items'] as List<Object?>)
.map((el) => PaymentLinkUpdateOptionsLineItemsItem.fromJson(el))
.toList(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
paymentIntentData: map['payment_intent_data'] == null
? null
: PaymentLinkUpdateOptionsPaymentIntentData.fromJson(
map['payment_intent_data']),
paymentMethodCollection: map['payment_method_collection'] == null
? null
: PaymentLinkCustomerCreation.fromJson(
map['payment_method_collection']),
paymentMethodTypes: map['payment_method_types'] == null
? null
: (map['payment_method_types'] as List<Object?>)
.map((el) => PaymentLinkPaymentMethodTypesItem.fromJson(el))
.toList(),
restrictions: map['restrictions'] == null
? null
: PaymentLinkCreateOptionsRestrictions.fromJson(map['restrictions']),
shippingAddressCollection: map['shipping_address_collection'] == null
? null
: PaymentPagesCheckoutSessionShippingAddressCollection.fromJson(
map['shipping_address_collection']),
subscriptionData: map['subscription_data'] == null
? null
: PaymentLinkUpdateOptionsSubscriptionData.fromJson(
map['subscription_data']),
);
}