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