@payware/mcp-server 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/auth/sandbox-setup.js +1 -1
  3. package/src/core/auth/jwt-token.js +61 -51
  4. package/src/isv/invitations/index.js +2 -1
  5. package/src/isv/oauth2/get-token-info.js +7 -5
  6. package/src/isv/oauth2/obtain-token.js +6 -4
  7. package/src/isv/oauth2/token-helper.js +26 -26
  8. package/src/isv/poi/cancel-price.js +7 -2
  9. package/src/isv/poi/get-poi.js +2 -3
  10. package/src/isv/poi/get-status.js +194 -168
  11. package/src/isv/poi/list-pois.js +4 -6
  12. package/src/isv/poi/set-price.js +38 -53
  13. package/src/isv/products/create-product.js +1 -1
  14. package/src/isv/transactions/simulate-callback.js +19 -10
  15. package/src/merchant/transactions/create-transaction.js +1 -1
  16. package/src/merchant/transactions/simulate-callback.js +322 -313
  17. package/src/merchant/transactions/transaction-history.js +2 -2
  18. package/src/payment-institution/transactions/get-transaction-history.js +1 -1
  19. package/src/payment-institution/transactions/get-transaction-status.js +1 -1
  20. package/src/payment-institution/transactions/simulate-pi-callback.js +385 -375
  21. package/src/payment-institution/transactions/soundbite-transaction.js +1 -1
  22. package/src/shared/poi/poi-create-api.js +1 -1
  23. package/src/tools/advanced-code-generator.js +14 -265
  24. package/src/utils/code-examples/common/auth-examples.js +1 -1
  25. package/src/utils/code-examples/isv/products.js +1 -1
  26. package/src/utils/code-examples/isv/transactions.js +1 -1
  27. package/src/utils/code-examples/merchant/transactions.js +1 -1
  28. package/src/utils/code-examples.js +2 -2
@@ -23,10 +23,12 @@ export const simulateCallbackTool = {
23
23
  so nothing here reaches the network. What you get back is the exact payload shape a real
24
24
  TRANSACTION_FINALIZED callback carries, which is what a handler needs in order to be written.
25
25
 
26
- **Callbacks go to the MERCHANT's callbackUrl, not to yours.** An ISV that needs to know a transaction
27
- finished either has the merchant forward it, or polls
28
- \`payware_operations_get_transaction_history\` for the ids it created. Simulating the payload here
29
- tells you what the merchant's endpoint will receive; it does not route anything to you.
26
+ **Where the callback goes.** A transaction you create on a merchant's behalf calls back to the
27
+ \`callbackUrl\` you give when creating it; a POI sale calls back to the POI's \`callbackUrl\`. Both are
28
+ signed with your ISV callback key, so verify them with your own payware public key. Give no callbackUrl
29
+ and that transaction sends no callbacks at all - the merchant's default URL is not used. Without a backend, follow the
30
+ transaction with \`payware_operations_get_transaction_status\` while it is ACTIVE and then
31
+ \`payware_operations_get_transaction_history\` once, or a POI sale with \`payware_poi_get_status\`.
30
32
 
31
33
  Four properties of the real payload that are easy to get wrong:
32
34
 
@@ -38,9 +40,11 @@ Four properties of the real payload that are easy to get wrong:
38
40
  **3. \`EXPIRED\` is a non-payment, not a failure.** The payer never paid within \`timeToLive\`. Release
39
41
  the order or the stock; do not treat it as an error to retry.
40
42
 
41
- **4. Deduplicate on \`(transactionId, callbackType)\`.** payware retries once a second, up to 15
42
- times, until the endpoint answers 200. That pair is stable across retries and is the key payware
43
- guarantees.
43
+ **4. Deduplicate on \`(transactionId, callbackType)\`.** payware retries up to 15 times, backing off
44
+ from about a second to at most 5 minutes between attempts, until the endpoint answers any 2xx. That
45
+ pair is stable across retries and is the key payware guarantees.
46
+
47
+ A POI sale's callback also carries \`poiId\`, the POI that created the transaction.
44
48
 
45
49
  **Not on this payload:** \`deliveryAddress\` (removed 2026-08-07 - fetch it from
46
50
  \`payware_operations_get_transaction_history\`), \`producerPartnerId\`, \`transactionType\` and
@@ -99,6 +103,10 @@ guarantees.
99
103
  enum: ['A2A', 'CARD_FUNDED', 'BNPL', 'INSTANT_CREDIT'],
100
104
  description: 'Payment method chosen by the customer. A2A = direct transfer. CARD_FUNDED = card-linked account. BNPL = buy now pay later. INSTANT_CREDIT = credit line.'
101
105
  },
106
+ poiId: {
107
+ type: 'string',
108
+ description: 'Set to simulate a POI sale: the callback then carries the poiId of the POI that created the transaction'
109
+ },
102
110
  merchantPartnerId: {
103
111
  type: 'string',
104
112
  description: 'Partner ID of the merchant whose callback this simulates. Used for labelling only - no call is made on their behalf.'
@@ -123,6 +131,7 @@ guarantees.
123
131
  feeRate = '0.0150',
124
132
  statusMessage,
125
133
  paymentMethod,
134
+ poiId,
126
135
  merchantPartnerId
127
136
  } = args;
128
137
 
@@ -131,7 +140,7 @@ guarantees.
131
140
  }
132
141
 
133
142
  const payload = generateMockCallback(transactionId, status, {
134
- amount, currency, fee, feeFixed, feeRate, statusMessage, paymentMethod
143
+ amount, currency, fee, feeFixed, feeRate, statusMessage, paymentMethod, poiId
135
144
  });
136
145
 
137
146
  const delivery = callbackUrl ? await simulateCallbackDelivery(callbackUrl, payload) : null;
@@ -141,7 +150,7 @@ guarantees.
141
150
  type: 'text',
142
151
  text: `🔔 **Simulated Callback Payload**${merchantPartnerId ? ` (ISV ${getPartnerIdSafe()} -> Merchant ${merchantPartnerId})` : ''}
143
152
 
144
- This is what payware would POST to the **merchant's** \`callbackUrl\`. No request was made.
153
+ This is what payware would POST to the transaction's (or POI's) \`callbackUrl\`. No request was made.
145
154
 
146
155
  \`\`\`json
147
156
  ${JSON.stringify(payload, null, 2)}
@@ -153,7 +162,7 @@ ${delivery.note}
153
162
  ` : '**No callbackUrl given** - payload only.'}
154
163
 
155
164
  **Building the handler:**
156
- 1. Answer **200** or payware retries - once a second, 15 times.
165
+ 1. Answer any **2xx** or payware retries - up to 15 times, backing off from about a second to 5 minutes.
157
166
  2. Deduplicate on \`(transactionId, callbackType)\`; retries repeat the same pair.
158
167
  3. Read properties defensively: absent means absent, never zero.
159
168
  4. Treat \`EXPIRED\` as a non-payment, not an error to retry.
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import { createJWTToken, generateContentMd5 } from '../../core/auth/jwt-token.js';
2
+ import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
5