SessionPaymentIntentData.fromJson constructor

SessionPaymentIntentData.fromJson(
  1. Object? json
)

Implementation

factory SessionPaymentIntentData.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SessionPaymentIntentData(
    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']),
    description:
        map['description'] == null ? null : (map['description'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    onBehalfOf:
        map['on_behalf_of'] == null ? null : (map['on_behalf_of'] as String),
    receiptEmail: map['receipt_email'] == null
        ? null
        : (map['receipt_email'] as String),
    setupFutureUsage: map['setup_future_usage'] == null
        ? null
        : SessionSetupFutureUsage.fromJson(map['setup_future_usage']),
    shipping: map['shipping'] == null
        ? null
        : SessionShipping.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),
  );
}