commit b1725091d794663f7a72e5165342f25ede92b407
parent ec8bb56f7a43087913e992dc33c117b6c8214d90
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 20 May 2026 20:56:56 +0200
fix version checks
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/TalerMerchantApiService.php b/src/TalerMerchantApiService.php
@@ -529,11 +529,15 @@ class TalerMerchantApiService {
case 'paid':
$paid = TRUE;
$contract_terms = $jbody['contract_terms'];
- $contract_version = $jbody['version'] ?? 0;
+ $contract_version = $contract_terms['version'] ?? 0;
$now = time();
switch ($contract_version) {
case 0:
- $this->logger->warning('Got unexpected v0 contract version');
+ $this->logger->warning('Got unexpected v0 contract version: Contract: @contract',
+ [
+ '@contract' => json_encode ($contract_terms, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES),
+ ],
+ );
break;
case 1:
$choice_index = $jbody['choice_index'] ?? 0;
@@ -881,7 +885,7 @@ class TalerMerchantApiService {
return FALSE;
}
// Pull out the paid amount. Contract version 1 stores choices.
- $contract_version = $jbody['version'] ?? 0;
+ $contract_version = $contract_terms['version'] ?? 0;
$paid_amount = NULL;
$subscription_slug = FALSE;
$subscription_expiration = 0;