Operation ID: createStripePaymentIntent
Create Stripe payment intent
+Creates a Stripe Terminal card payment intent with fixed 25% moms.
Security requirements:
@@ -32,9 +32,6 @@ }, "reader": { "type": "string" - }, - "tax_percentage": { - "type": "integer" } }, "required": [ diff --git a/openapi.yaml b/openapi.yaml index 7a6367d1..de73f5f9 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -8475,6 +8475,7 @@ paths: tags: - Orders summary: Create Stripe payment intent + description: Creates a Stripe Terminal card payment intent with fixed 25% moms. operationId: createStripePaymentIntent requestBody: required: true @@ -8486,7 +8487,6 @@ paths: properties: id: {type: integer} reader: {type: string} - tax_percentage: {type: integer} responses: '200': description: Success diff --git a/services/nginx/app/classes/invoice_collection_bulk_action_service.php b/services/nginx/app/classes/invoice_collection_bulk_action_service.php index a5fed29d..5eac93f8 100644 --- a/services/nginx/app/classes/invoice_collection_bulk_action_service.php +++ b/services/nginx/app/classes/invoice_collection_bulk_action_service.php @@ -82,6 +82,18 @@ class invoice_collection_bulk_action_service if (!empty($freshPreview['blockers'])) { throw new Exception('Action cannot be applied while blockers are present.'); } + $lockedCollectionIds = [ + ...$invoiceCollectionIds, + (int)($options['target_invoice_collection_id'] ?? 0), + ]; + $paymentMutationLock = order_payment_lock::tryAcquireInvoiceCollections( + $lockedCollectionIds + ); + if ($paymentMutationLock === null) { + throw new Exception( + 'An invoice collection is currently being changed or paid. Try again.' + ); + } $db->conn()->begin_transaction(); try { diff --git a/services/nginx/app/classes/order_payment_lock.php b/services/nginx/app/classes/order_payment_lock.php new file mode 100644 index 00000000..366a1b80 --- /dev/null +++ b/services/nginx/app/classes/order_payment_lock.php @@ -0,0 +1,241 @@ + */ + private array $lockNames = []; + + public static function tryAcquire(int $orderId): ?self + { + return self::tryAcquireResource(self::ORDER_RESOURCE, $orderId); + } + + public static function tryAcquireInvoiceCollection(int $invoiceCollectionId): ?self + { + return self::tryAcquireResource(self::INVOICE_COLLECTION_RESOURCE, $invoiceCollectionId); + } + + public static function tryAcquireOrderMutation(int $orderId): ?self + { + return self::tryAcquireOrderMutations([$orderId]); + } + + /** + * @param list