TreasuryOutboundPaymentCreateOptions.fromJson constructor

TreasuryOutboundPaymentCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory TreasuryOutboundPaymentCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TreasuryOutboundPaymentCreateOptions(
    amount: (map['amount'] as num).toInt(),
    currency: (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    destinationPaymentMethod: map['destination_payment_method'] == null
        ? null
        : (map['destination_payment_method'] as String),
    destinationPaymentMethodData:
        map['destination_payment_method_data'] == null
            ? null
            : OutboundPaymentDestinationPaymentMethodData.fromJson(
                map['destination_payment_method_data']),
    destinationPaymentMethodOptions:
        map['destination_payment_method_options'] == null
            ? null
            : OutboundPaymentDestinationPaymentMethodOptions.fromJson(
                map['destination_payment_method_options']),
    endUserDetails: map['end_user_details'] == null
        ? null
        : OutboundPaymentEndUserDetails.fromJson(map['end_user_details']),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    financialAccount: (map['financial_account'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    statementDescriptor: map['statement_descriptor'] == null
        ? null
        : (map['statement_descriptor'] as String),
  );
}