PaymentLinkCreateOptions.fromJson constructor
PaymentLinkCreateOptions.fromJson(
- Object? json
Implementation
factory PaymentLinkCreateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return PaymentLinkCreateOptions(
afterCompletion: map['after_completion'] == null
? null
: PaymentLinkAfterCompletion.fromJson(map['after_completion']),
allowPromotionCodes: map['allow_promotion_codes'] == null
? null
: (map['allow_promotion_codes'] as bool),
applicationFeeAmount: map['application_fee_amount'] == null
? null
: (map['application_fee_amount'] as num).toInt(),
applicationFeePercent: map['application_fee_percent'] == null
? null
: (map['application_fee_percent'] as num).toDouble(),
automaticTax: map['automatic_tax'] == null
? null
: SessionAutomaticTax.fromJson(map['automatic_tax']),
billingAddressCollection: map['billing_address_collection'] == null
? null
: PaymentLinkBillingAddressCollection.fromJson(
map['billing_address_collection']),
consentCollection: map['consent_collection'] == null
? null
: SessionConsentCollection.fromJson(map['consent_collection']),
currency: map['currency'] == null ? null : (map['currency'] as String),
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'] as List<Object?>)
.map((el) => PaymentLinkLineItemsItem.fromJson(el))
.toList(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
onBehalfOf:
map['on_behalf_of'] == null ? null : (map['on_behalf_of'] as String),
paymentIntentData: map['payment_intent_data'] == null
? null
: PaymentLinkCreateOptionsPaymentIntentData.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(),
phoneNumberCollection: map['phone_number_collection'] == null
? null
: PortalSubscriptionPause.fromJson(map['phone_number_collection']),
restrictions: map['restrictions'] == null
? null
: PaymentLinkCreateOptionsRestrictions.fromJson(map['restrictions']),
shippingAddressCollection: map['shipping_address_collection'] == null
? null
: PaymentPagesCheckoutSessionShippingAddressCollection.fromJson(
map['shipping_address_collection']),
shippingOptions: map['shipping_options'] == null
? null
: (map['shipping_options'] as List<Object?>)
.map((el) => CreditNoteShippingCost.fromJson(el))
.toList(),
submitType: map['submit_type'] == null
? null
: PaymentLinkSubmitType.fromJson(map['submit_type']),
subscriptionData: map['subscription_data'] == null
? null
: PaymentLinkCreateOptionsSubscriptionData.fromJson(
map['subscription_data']),
taxIdCollection: map['tax_id_collection'] == null
? null
: PortalSubscriptionPause.fromJson(map['tax_id_collection']),
transferData: map['transfer_data'] == null
? null
: ChargeCreateOptionsTransferData.fromJson(map['transfer_data']),
);
}