Source.fromJson constructor

Source.fromJson(
  1. Object? json
)

Implementation

factory Source.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Source(
    achCreditTransfer: map['ach_credit_transfer'] == null
        ? null
        : SourceTypeAchCreditTransfer.fromJson(map['ach_credit_transfer']),
    achDebit: map['ach_debit'] == null
        ? null
        : SourceTypeAchDebit.fromJson(map['ach_debit']),
    acssDebit: map['acss_debit'] == null
        ? null
        : SourceTypeAcssDebit.fromJson(map['acss_debit']),
    alipay: map['alipay'] == null
        ? null
        : SourceTypeAlipay.fromJson(map['alipay']),
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    auBecsDebit: map['au_becs_debit'] == null
        ? null
        : SourceTypeAuBecsDebit.fromJson(map['au_becs_debit']),
    bancontact: map['bancontact'] == null
        ? null
        : SourceTypeBancontact.fromJson(map['bancontact']),
    card: map['card'] == null ? null : SourceTypeCard.fromJson(map['card']),
    cardPresent: map['card_present'] == null
        ? null
        : SourceTypeCardPresent.fromJson(map['card_present']),
    clientSecret: (map['client_secret'] as String),
    codeVerification: map['code_verification'] == null
        ? null
        : SourceCodeVerificationFlow.fromJson(map['code_verification']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: map['currency'] == null ? null : (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    eps: map['eps'] == null ? null : SourceTypeEps.fromJson(map['eps']),
    flow: (map['flow'] as String),
    giropay: map['giropay'] == null
        ? null
        : SourceTypeGiropay.fromJson(map['giropay']),
    id: (map['id'] as String),
    ideal:
        map['ideal'] == null ? null : SourceTypeIdeal.fromJson(map['ideal']),
    klarna: map['klarna'] == null
        ? null
        : SourceTypeKlarna.fromJson(map['klarna']),
    livemode: (map['livemode'] as bool),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    multibanco: map['multibanco'] == null
        ? null
        : SourceTypeMultibanco.fromJson(map['multibanco']),
    owner: map['owner'] == null ? null : SourceOwner.fromJson(map['owner']),
    p24: map['p24'] == null ? null : SourceTypeP24.fromJson(map['p24']),
    receiver: map['receiver'] == null
        ? null
        : SourceReceiverFlow.fromJson(map['receiver']),
    redirect: map['redirect'] == null
        ? null
        : SourceRedirectFlow.fromJson(map['redirect']),
    sepaCreditTransfer: map['sepa_credit_transfer'] == null
        ? null
        : SourceTypeSepaCreditTransfer.fromJson(map['sepa_credit_transfer']),
    sepaDebit: map['sepa_debit'] == null
        ? null
        : SourceTypeSepaDebit.fromJson(map['sepa_debit']),
    sofort: map['sofort'] == null
        ? null
        : SourceTypeSofort.fromJson(map['sofort']),
    sourceOrder: map['source_order'] == null
        ? null
        : SourceOrder.fromJson(map['source_order']),
    statementDescriptor: map['statement_descriptor'] == null
        ? null
        : (map['statement_descriptor'] as String),
    status: (map['status'] as String),
    threeDSecure: map['three_d_secure'] == null
        ? null
        : SourceTypeThreeDSecure.fromJson(map['three_d_secure']),
    type: SourceType.fromJson(map['type']),
    usage: map['usage'] == null ? null : (map['usage'] as String),
    wechat: map['wechat'] == null
        ? null
        : SourceTypeWechat.fromJson(map['wechat']),
  );
}