PaymentIntentCreateOptions.fromJson constructor

PaymentIntentCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory PaymentIntentCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PaymentIntentCreateOptions(
    amount: (map['amount'] as num).toInt(),
    applicationFeeAmount: map['application_fee_amount'] == null
        ? null
        : (map['application_fee_amount'] as num).toInt(),
    automaticPaymentMethods: map['automatic_payment_methods'] == null
        ? null
        : PaymentFlowsAutomaticPaymentMethodsPaymentIntent.fromJson(
            map['automatic_payment_methods']),
    captureMethod: map['capture_method'] == null
        ? null
        : PaymentIntentCaptureMethod.fromJson(map['capture_method']),
    confirm: map['confirm'] == null ? null : (map['confirm'] as bool),
    confirmationMethod: map['confirmation_method'] == null
        ? null
        : CustomerBalanceCustomerBalanceSettingsReconciliationMode.fromJson(
            map['confirmation_method']),
    confirmationToken: map['confirmation_token'] == null
        ? null
        : (map['confirmation_token'] as String),
    currency: (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    errorOnRequiresAction: map['error_on_requires_action'] == null
        ? null
        : (map['error_on_requires_action'] as bool),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    mandate: map['mandate'] == null ? null : (map['mandate'] as String),
    mandateData: map['mandate_data'] == null
        ? null
        : PaymentIntentMandateData.fromJson(map['mandate_data']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    offSession: map['off_session'] == null
        ? null
        : PaymentIntentOffSession.fromJson(map['off_session']),
    onBehalfOf:
        map['on_behalf_of'] == null ? null : (map['on_behalf_of'] 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(),
    radarOptions: map['radar_options'] == null
        ? null
        : RadarRadarOptions.fromJson(map['radar_options']),
    receiptEmail: map['receipt_email'] == null
        ? null
        : (map['receipt_email'] as String),
    returnUrl:
        map['return_url'] == null ? null : (map['return_url'] as String),
    setupFutureUsage: map['setup_future_usage'] == null
        ? null
        : SessionSetupFutureUsage.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
        : ChargeCreateOptionsTransferData.fromJson(map['transfer_data']),
    transferGroup: map['transfer_group'] == null
        ? null
        : (map['transfer_group'] as String),
    useStripeSdk: map['use_stripe_sdk'] == null
        ? null
        : (map['use_stripe_sdk'] as bool),
  );
}