Separated request idempotency from intent identity #330
@@ -9,6 +9,7 @@ part 'quote.g.dart';
|
||||
@JsonSerializable()
|
||||
class QuotePaymentRequest extends PaymentBaseRequest {
|
||||
final PaymentIntentDTO intent;
|
||||
final String? intentKey;
|
||||
|
||||
@JsonKey(defaultValue: false)
|
||||
final bool previewOnly;
|
||||
@@ -17,6 +18,7 @@ class QuotePaymentRequest extends PaymentBaseRequest {
|
||||
required super.idempotencyKey,
|
||||
super.metadata,
|
||||
required this.intent,
|
||||
this.intentKey,
|
||||
this.previewOnly = false,
|
||||
});
|
||||
|
||||
|
||||
@@ -91,12 +91,14 @@ class QuotationProvider extends ChangeNotifier {
|
||||
if (!_organizations.isOrganizationSet) throw StateError('Organization is not set');
|
||||
_lastIntent = intent;
|
||||
try {
|
||||
final intentKey = _buildIntentKey(intent);
|
||||
_setResource(_quotation.copyWith(isLoading: true, error: null));
|
||||
final response = await QuotationService.getQuotation(
|
||||
_organizations.current.id,
|
||||
QuotePaymentRequest(
|
||||
idempotencyKey: Uuid().v4(),
|
||||
intent: intent.toDTO(),
|
||||
intentKey: intentKey,
|
||||
),
|
||||
);
|
||||
_isLoaded = true;
|
||||
|
||||
Reference in New Issue
Block a user