PaymentIntentUpdateOptions.fromJson constructor

PaymentIntentUpdateOptions.fromJson(
  1. Object? json
)

Implementation

factory PaymentIntentUpdateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PaymentIntentUpdateOptions(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    applicationFeeAmount: map['application_fee_amount'] == null
        ? null
        : (map['application_fee_amount'] as num).toInt(),
    captureMethod: map['capture_method'] == null
        ? null
        : PaymentIntentCaptureMethod.fromJson(map['capture_method']),
    currency: map['currency'] == null ? null : (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    paymentMethod: map['payment_method'] == null
        ? null
        : (map['payment_method'] as String),
    paymentMethodConfiguration: map['payment_method_configuration'] == null
        ? null
        : (map['payment_method_configuration'] as String),
    paymentMethodData: map['payment_method_data'] == null
        ? null
        : PaymentIntentPaymentMethodData.fromJson(map['payment_method_data']),
    paymentMethodOptions: map['payment_method_options'] == null
        ? null
        : PaymentIntentCreateOptionsPaymentMethodOptions.fromJson(
            map['payment_method_options']),
    paymentMethodTypes: map['payment_method_types'] == null
        ? null
        : (map['payment_method_types'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    receiptEmail: map['receipt_email'] == null
        ? null
        : (map['receipt_email'] as String),
    setupFutureUsage: map['setup_future_usage'] == null
        ? null
        : PaymentIntentUpdateOptionsSetupFutureUsage.fromJson(
            map['setup_future_usage']),
    shipping: map['shipping'] == null
        ? null
        : ChargeCreateOptionsShipping.fromJson(map['shipping']),
    statementDescriptor: map['statement_descriptor'] == null
        ? null
        : (map['statement_descriptor'] as String),
    statementDescriptorSuffix: map['statement_descriptor_suffix'] == null
        ? null
        : (map['statement_descriptor_suffix'] as String),
    transferData: map['transfer_data'] == null
        ? null
        : PaymentFlowsAmountDetailsResourceTip.fromJson(map['transfer_data']),
    transferGroup: map['transfer_group'] == null
        ? null
        : (map['transfer_group'] as String),
  );
}