tokenization_module_input_data.dart 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import 'package:yookassa_payments_flutter/models/amount.dart';
  2. import 'package:yookassa_payments_flutter/models/customization_settings.dart';
  3. import 'package:yookassa_payments_flutter/models/google_pay_parameters.dart';
  4. import 'package:yookassa_payments_flutter/models/method_save_payment.dart';
  5. import 'package:yookassa_payments_flutter/models/test_mode_settings.dart';
  6. import 'package:yookassa_payments_flutter/models/tokenization_settings.dart';
  7. import 'package:yookassa_payments_flutter/models/host_parameters.dart';
  8. class TokenizationModuleInputData {
  9. String clientApplicationKey;
  10. String title;
  11. String subtitle;
  12. Amount amount;
  13. SavePaymentMethod savePaymentMethod;
  14. String shopId;
  15. String? moneyAuthClientId;
  16. HostParameters? hostParameters;
  17. String? gatewayId;
  18. TokenizationSettings tokenizationSettings;
  19. TestModeSettings? testModeSettings;
  20. String? returnUrl;
  21. bool isLoggingEnabled;
  22. String? userPhoneNumber;
  23. CustomizationSettings customizationSettings;
  24. String? applicationScheme;
  25. String? customerId;
  26. GooglePayParameters googlePayParameters;
  27. bool googlePayTestEnvironment;
  28. TokenizationModuleInputData(
  29. {required this.clientApplicationKey,
  30. required this.title,
  31. required this.subtitle,
  32. required this.amount,
  33. required this.savePaymentMethod,
  34. required this.shopId,
  35. this.moneyAuthClientId,
  36. this.hostParameters,
  37. this.gatewayId,
  38. this.tokenizationSettings = const TokenizationSettings(),
  39. this.testModeSettings,
  40. this.returnUrl,
  41. this.isLoggingEnabled = false,
  42. this.userPhoneNumber,
  43. this.customizationSettings = const CustomizationSettings(),
  44. this.applicationScheme,
  45. this.customerId,
  46. this.googlePayParameters = const GooglePayParameters(),
  47. this.googlePayTestEnvironment = false});
  48. Map<String, dynamic> toJson() => {
  49. 'clientApplicationKey': clientApplicationKey,
  50. 'title': title,
  51. 'subtitle': subtitle,
  52. 'amount': amount.toJson(),
  53. 'savePaymentMethod': savePaymentMethod.toString(),
  54. 'hostParameters': hostParameters?.toJson(),
  55. 'gatewayId': gatewayId,
  56. 'tokenizationSettings': tokenizationSettings.toJson(),
  57. 'testModeSettings': testModeSettings?.toJson(),
  58. 'shopId': shopId,
  59. 'returnUrl': returnUrl,
  60. 'isLoggingEnabled': isLoggingEnabled,
  61. 'userPhoneNumber': userPhoneNumber,
  62. 'customizationSettings': customizationSettings.toJson(),
  63. 'moneyAuthClientId': moneyAuthClientId,
  64. 'applicationScheme': applicationScheme,
  65. 'customerId': customerId,
  66. 'googlePayParameters': googlePayParameters.jsonList(),
  67. 'googlePayTestEnvironment': googlePayTestEnvironment
  68. };
  69. }