SetupIntent.fromJson constructor
SetupIntent.fromJson(
- Object? json
Implementation
factory SetupIntent.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return SetupIntent(
application: map['application'] == null
? null
: ApplicationOrId.fromJson(map['application']),
attachToSelf: map['attach_to_self'] == null
? null
: (map['attach_to_self'] as bool),
automaticPaymentMethods: map['automatic_payment_methods'] == null
? null
: PaymentFlowsAutomaticPaymentMethodsSetupIntent.fromJson(
map['automatic_payment_methods']),
cancellationReason: map['cancellation_reason'] == null
? null
: SetupIntentCancellationReason.fromJson(map['cancellation_reason']),
clientSecret: map['client_secret'] == null
? null
: (map['client_secret'] as String),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
customer: map['customer'] == null
? null
: BankAccountCustomerOrId.fromJson(map['customer']),
description:
map['description'] == null ? null : (map['description'] as String),
flowDirections: map['flow_directions'] == null
? null
: (map['flow_directions'] as List<Object?>)
.map((el) => SetupAttemptFlowDirectionsItem.fromJson(el))
.toList(),
id: (map['id'] as String),
lastSetupError: map['last_setup_error'] == null
? null
: ApiErrors.fromJson(map['last_setup_error']),
latestAttempt: map['latest_attempt'] == null
? null
: SetupAttemptOrId.fromJson(map['latest_attempt']),
livemode: (map['livemode'] as bool),
mandate:
map['mandate'] == null ? null : MandateOrId.fromJson(map['mandate']),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
nextAction: map['next_action'] == null
? null
: SetupIntentNextAction.fromJson(map['next_action']),
onBehalfOf: map['on_behalf_of'] == null
? null
: AccountOrId.fromJson(map['on_behalf_of']),
paymentMethod: map['payment_method'] == null
? null
: PaymentMethodOrId.fromJson(map['payment_method']),
paymentMethodConfigurationDetails:
map['payment_method_configuration_details'] == null
? null
: PaymentMethodConfigBizPaymentMethodConfigurationDetails
.fromJson(map['payment_method_configuration_details']),
paymentMethodOptions: map['payment_method_options'] == null
? null
: SetupIntentPaymentMethodOptions.fromJson(
map['payment_method_options']),
paymentMethodTypes: (map['payment_method_types'] as List<Object?>)
.map((el) => (el as String))
.toList(),
singleUseMandate: map['single_use_mandate'] == null
? null
: MandateOrId.fromJson(map['single_use_mandate']),
status: SetupIntentStatus.fromJson(map['status']),
usage: (map['usage'] as String),
);
}