SourceCreateOptions.fromJson constructor

SourceCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory SourceCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SourceCreateOptions(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    currency: map['currency'] == null ? null : (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    flow: map['flow'] == null ? null : SourceFlow.fromJson(map['flow']),
    mandate: map['mandate'] == null
        ? null
        : SourceMandate.fromJson(map['mandate']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    originalSource: map['original_source'] == null
        ? null
        : (map['original_source'] as String),
    owner: map['owner'] == null ? null : CardOwner.fromJson(map['owner']),
    receiver: map['receiver'] == null
        ? null
        : SourceReceiver.fromJson(map['receiver']),
    redirect: map['redirect'] == null
        ? null
        : PortalFlowsAfterCompletionRedirect.fromJson(map['redirect']),
    sourceOrder: map['source_order'] == null
        ? null
        : SourceOrder.fromJson(map['source_order']),
    statementDescriptor: map['statement_descriptor'] == null
        ? null
        : (map['statement_descriptor'] as String),
    token: map['token'] == null ? null : (map['token'] as String),
    type: map['type'] == null ? null : (map['type'] as String),
    usage: map['usage'] == null ? null : SourceUsage.fromJson(map['usage']),
  );
}