@octap/sdk 0.2.0 → 0.4.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Changed
6
+
7
+ - Customer tokens are bound to one organization (OCT-394). `verifyCustomer(token)` takes the
8
+ customer token from `@octap/browser-sdk` 0.2's `getIdToken()`, no longer a Google id_token, and
9
+ answers 401 for a token issued for another organization than your API key's. Its result type,
10
+ `VerifyCustomerResponse`, is exported.
11
+ - `baseUrl` defaults to `https://api.octap.biz` (exported as `DEFAULT_BASE_URL`) instead of
12
+ `http://localhost:3000`.
13
+
14
+ ### Added
15
+
16
+ - `getLicense()` (OCT-329): your organization's license (plan, `startsAt`, `endsAt`, `state`
17
+ `ACTIVE`/`GRACE`/`EXPIRED`, what it includes) and how much of each limit is in use this license
18
+ month. `read` scope.
19
+ - License limits (OCT-329): a request the license doesn't cover answers **402** with `code`
20
+ `LICENSE_LIMIT_REACHED` (`limit`, `used`, `allowed`: the plan's limit) or `LICENSE_FEATURE_NOT_INCLUDED`
21
+ (`feature`). Earn, POS reserve and paid claims stop at 110% of the monthly transactions; voucher
22
+ batches need `voucher.batches`, sandbox keys need `sandbox`. Types: `LicenseErrorBody`,
23
+ `LicenseErrorCode`.
24
+ - Webhook `license.usage_threshold` (`LicenseUsageThresholdEventData`): sent once per license month
25
+ at 80% and at 100% of the monthly transactions.
26
+ - License expiry (OCT-329): 7 days after a license ends (its grace period), earns, POS reserves and
27
+ paid voucher claims answer **402 `LICENSE_EXPIRED`**; everything else keeps working. Webhook
28
+ `license.expiry_notice` (`LicenseExpiryNoticeEventData`) is sent 30, 7 and 1 days before the end,
29
+ when the grace period starts and when it is over (`stage`), once each. Types:
30
+ `LicenseExpiryStage`, `LICENSE_EXPIRY_STAGES`, `LICENSE_EXPIRY_REMINDER_DAYS`.
31
+ - License purchases (OCT-330): webhooks `license.activated`, `license.renewed` and `license.upgraded`
32
+ (`LicensePurchasedEventData`) when a bank transfer pays a license order, and
33
+ `license.payment_needs_attention` (`LicensePaymentNeedsAttentionEventData`) when one couldn't
34
+ (too little, expired, canceled or already paid). Types: `LicenseOrderDto`, `PaymentTransferStatus`,
35
+ `PaymentUnmatchedReason`.
36
+ - Campaigns (OCT-340): `earnPoints({ ..., campaignId })` applies an Owner's time-boxed campaign
37
+ multiplier (up to 10x, from the issuance budget); a campaign that isn't `ACTIVE`, is outside its
38
+ dates or has no multiplier is a 422, never an earn at the base rate. `createVouchers(items,
39
+ { campaignId })` puts a batch's vouchers in a campaign. `VoucherDto.campaignId`, and
40
+ `credits.earned` webhooks carry `campaignId` when a campaign boosted the earn. Needs
41
+ `@octap/contracts` with the campaign types.
42
+ - Transactions by date: `listOrganizationTransactions({ from, to })` and `listTransactions(memberId,
43
+ { from, to })` keep the transactions created from `from` (included) to `to` (excluded), ISO 8601
44
+ date-times with an offset or Z. Needs `@octap/contracts` with the `from`/`to` query fields.
45
+ - `listCampaigns({ live })` and `getCampaign(id)` (`GET /v1/campaigns`, `read` scope): a POS lists
46
+ the campaigns that boost an earn right now, so the cashier can pick one.
47
+
48
+ ## 0.3.0
49
+
50
+ ### Added
51
+
52
+ - On-chain evidence reads (OCT-334): `listOrganizationTransactions(query)` (the organization's
53
+ points history with each confirmed row's Sui digest, filtered by type, status or member),
54
+ `getProgram()` (the program's on-chain policy compared with the rules OctaP applies) and
55
+ `getBalanceReconciliation(memberId)` (`MATCH` / `PENDING` / `MISMATCH` / `UNAVAILABLE`). All need
56
+ only a `read` key.
57
+
3
58
  ## 0.2.0
4
59
 
5
60
  ### Added
package/README.md CHANGED
@@ -1,45 +1,68 @@
1
- # Node merchant SDK
2
- `src/client.ts` is the merchant client (points and vouchers) over the REST transport in
3
- `src/transports/`. `src/errors/` holds `OctaSdkError` and `OctaApiError`. `src/webhooks.ts` is
4
- the receiver side: `verifyWebhookSignature` checks `x-octap-signature`, and
5
- `constructWebhookEvent` checks it and returns the typed `WebhookEvent` (discriminated on `type`).
6
- Public DTOs come from the sibling contracts package. Do not import this package into browser code;
7
- browser helpers have their own package.
1
+ # @octap/sdk
2
+
3
+ Server-side Node.js SDK for the Octap Core loyalty API: earn and redeem points, manage vouchers,
4
+ verify customers and receive webhooks. Run it on your backend only. The API key it holds must never
5
+ reach a browser; customer sign-in and signing are in `@octap/browser-sdk`.
6
+
7
+ ```bash
8
+ npm install @octap/sdk
9
+ ```
10
+
11
+ ## Create a client
12
+
13
+ Create one client and reuse it. It calls `https://api.octap.biz`; set `baseUrl` only to reach
14
+ another Core, such as one running locally. The organization comes from the API key.
15
+
16
+ ```ts
17
+ import { createOctaPointClient } from '@octap/sdk';
18
+
19
+ export const client = createOctaPointClient({
20
+ credentials: { apiKey: process.env.OCTAP_API_KEY },
21
+ });
22
+ ```
23
+
24
+ A `read` key is enough for every read. Every other call needs a `write` key. Every method takes an
25
+ optional last argument, `RequestOptions`: `{ organizationId, signal }`.
8
26
 
9
27
  ## Verifying a customer
10
28
 
11
- Your frontend gets an id_token from the browser SDK and sends it to your backend. Check it before
12
- acting for that customer, like Firebase Admin's `verifyIdToken`:
29
+ Your frontend gets a customer token from the browser SDK's `getIdToken()` and sends it to your
30
+ backend. Check it before acting for that customer, as you would with Firebase Admin's
31
+ `verifyIdToken`:
13
32
 
14
33
  ```ts
15
- const { suiAddress, memberId, active } = await client.verifyCustomer(idToken);
16
- if (!memberId) {
17
- // A valid Google sign-in that has not enrolled in your organization yet.
18
- } else if (!active) {
19
- // Enrolled, but blocked: reward operations for this member will be refused.
34
+ const { suiAddress, memberId, active } = await client.verifyCustomer(token);
35
+ if (!active) {
36
+ // Blocked, or no longer a member: reward operations for this customer will be refused.
20
37
  }
21
38
  ```
22
39
 
23
- An invalid or expired token throws `OctaApiError` with status 401. The call needs the `read` scope
24
- and writes nothing. Every merchant shares one OctaP Google client ID, so a token a customer showed
25
- to another merchant also verifies here: treat it as proof of who the customer is, not of consent to
26
- anything, and keep spending behind the customer's signature.
27
-
28
- ## Merchant methods
40
+ Core signs the token for your organization when the customer signs in on OctaP's page, which
41
+ also enrolls them. An expired token, or one issued for another organization than your API key's,
42
+ throws `OctaApiError` with status 401: a customer signed in at another merchant is never signed in
43
+ here. The call needs the `read` scope and writes nothing. Keep every spend behind the customer's
44
+ signature, which only your page can make.
29
45
 
30
- Keep the API key on a trusted Node server. Console/platform session routes and API credential
31
- management are outside this client. Every method accepts `RequestOptions` with `organizationId`
32
- and `signal`, including both balance overloads.
46
+ ## Methods
33
47
 
34
48
  | Core routes | SDK methods |
35
49
  | --- | --- |
36
- | `POST /v1/credits/earn` | `earnPoints({ organizationEndUserId, purchaseAmount, idempotencyKey })` |
50
+ | `POST /v1/identity/verify` | `verifyCustomer(token)` |
51
+ | `POST /v1/credits/earn` | `earnPoints({ organizationEndUserId, purchaseAmount, idempotencyKey, campaignId? })` |
52
+ | `GET /v1/campaigns` | `listCampaigns({ live? })` |
53
+ | `GET /v1/campaigns/:id` | `getCampaign(campaignId)` |
37
54
  | `POST /v1/credits/redeem/reserve`, `/finalize` | `reservePosRedemption`, `finalizePosRedemption` |
38
55
  | `POST /v1/credits/transactions/:id/reverse` | `reverseTransaction` |
39
- | `GET /v1/credits/members/:id/balance`, `/transactions` | `getBalance`, `listTransactions` |
56
+ | `GET /v1/credits/members/:id/balance`, `/transactions` | `getBalance`, `listTransactions(memberId, { limit, cursor, from, to })` |
40
57
  | `GET /v1/credits/budget` | `getIssuanceBudget` |
58
+ | `GET /v1/license` | `getLicense` |
59
+ | `GET /v1/credits/transactions` | `listOrganizationTransactions({ type, status, memberId, from, to, limit, cursor })` |
60
+ | `GET /v1/credits/program` | `getProgram` |
61
+ | `GET /v1/credits/members/:id/reconciliation` | `getBalanceReconciliation` |
41
62
  | `GET /v1/rewards/refund-policy`, `GET .../history` | `getVoucherRefundPolicy`, `listVoucherRefundPolicyHistory` |
42
63
  | `POST/GET /v1/rewards/vouchers`, `GET/PATCH .../:id` | `createVoucher`, `listVouchers`, `getVoucher`, `updateVoucher` |
64
+ | `POST/GET /v1/rewards/voucher-batches`, `GET .../:id` | `createVouchers(items, { dryRun, name, campaignId })`, `listVoucherBatches`, `getVoucherBatch` |
65
+ | `POST .../voucher-batches/:id/activate`, `/pause`, `/resume`, `/archive` | `activateVoucherBatch`, `pauseVoucherBatch`, `resumeVoucherBatch`, `archiveVoucherBatch` |
43
66
  | `POST .../vouchers/:id/claim`, `GET .../claims/:id` | `claimVoucher`, `getVoucherClaim` |
44
67
  | `POST .../vouchers/:id/grant` | `grantVoucher` |
45
68
  | `POST .../vouchers/use`, `/use/finalize` | `prepareVoucherUse`, `finalizeVoucherUse` |
@@ -47,11 +70,34 @@ and `signal`, including both balance overloads.
47
70
  | `GET /v1/webhooks/endpoints` | `listWebhookEndpoints` |
48
71
  | `GET /v1/webhooks/deliveries` | `listWebhookDeliveries` |
49
72
 
50
- `finalizeVoucherClaim` is an alias for the shared finalize route. Customer signatures authorize
51
- finalization; no merchant credential is needed there. A `read` key is enough for every read here; a
52
- `write` key for the rest. The Owner registers, disables, enables and rotates webhook endpoints, replays
53
- deliveries and publishes the refund policy in the console, not with a key (removed from the SDK in
54
- 0.2.0, see `CHANGELOG.md`). List responses never include a webhook secret.
73
+ - **Finalize routes.** `finalizeVoucherClaim` is an alias for the POS finalize route. The customer's
74
+ signature authorizes every finalize, so the merchant key isn't what permits it.
75
+ - **`getBalance` has two forms.** `getBalance(memberId)` returns the `CreditBalanceSnapshot`.
76
+ `getBalance(programId, memberId)` returns the older `BalanceSnapshot`, with snake_case string
77
+ fields, and answers 404 for a program outside your organization.
78
+ - **What stays in the console.** The Owner registers, disables, enables and rotates webhook
79
+ endpoints, replays deliveries, and publishes the refund policy there, not with a key. These were
80
+ removed from the SDK in 0.2.0; see `CHANGELOG.md`. List responses never include a webhook secret.
81
+
82
+ ### Voucher CSV
83
+
84
+ `parseVoucherCsv(text, { utcOffset })` reads a CSV in the Octap voucher template, the file the
85
+ console imports, into items for `createVouchers`. It runs the console's checks: each bad row is
86
+ reported with its line and column, and left out. `VOUCHER_CSV_TEMPLATE`, `VOUCHER_CSV_TYPES`,
87
+ `VOUCHER_BENEFIT_SCHEMA` and `suggestVoucherCode` are exported too.
88
+
89
+ ## On-chain evidence
90
+
91
+ Every confirmed point movement is a Sui transaction. These reads let you show customers that proof,
92
+ or check it yourself:
93
+
94
+ - `listOrganizationTransactions` is your whole organization's history, newest first. Each confirmed
95
+ row has its `blockchainDigest` and `confirmedAt`; link the digest to a Sui explorer.
96
+ - `getProgram` returns your earn rules as published on Sui. `policyStatus: 'MATCH'` means they are
97
+ the rules OctaP applies.
98
+ - `getBalanceReconciliation(memberId)` compares the balance OctaP records with what the member's
99
+ `CreditAccount` on Sui can spend. `PENDING` means something is still on its way to the chain, so ask
100
+ again shortly. `MISMATCH` means nothing is in flight and the two differ.
55
101
 
56
102
  ## Earn
57
103
 
@@ -65,28 +111,56 @@ const accepted = await client.earnPoints({
65
111
  // Read listTransactions or consume credits.earn.confirmed for the actual point result.
66
112
  ```
67
113
 
68
- A purchase too small to earn a point is rejected with 400, and an earn the issuance budget cannot cover with 422. An accepted earn that fails sends `credits.earn.failed`; its key stays used, so a retry needs a new key. History shows `pointsAmount: null` and a
69
- separate `estimatedPoints` until the chain confirms. Core has no operation-status route: observe
70
- transactions, balance, `getVoucherClaim` or webhooks. To debit points, use `reservePosRedemption`,
71
- return the bytes to the customer to sign, then call `finalizePosRedemption`.
72
- `getBalance(programId, memberId, options)` returns 404 for a program outside your organization.
114
+ - **Rejected earns.** A purchase too small to earn a point is a 400. An earn the issuance budget
115
+ can't cover is a 422.
116
+ - **Failed earns.** An accepted earn that fails sends `credits.earn.failed`. Its key stays used, so
117
+ a retry needs a new key.
118
+ - **Until the chain confirms.** History shows `pointsAmount: null` and a separate
119
+ `estimatedPoints`. Core has no operation-status route: watch transactions, the balance,
120
+ `getVoucherClaim` or webhooks.
121
+ - **Debiting points.** Call `reservePosRedemption`, have the customer sign the returned bytes, then
122
+ call `finalizePosRedemption`.
73
123
 
74
- ## Errors, cancellation and retries
124
+ ## Webhooks
75
125
 
76
- `OctaApiError` exposes `statusCode`, `statusText`, `responseBody`, and `retryAfter` when Core sent
77
- that header. `OctaNetworkError` preserves the original `cause`. `OctaRequestAbortedError` distinguishes
78
- cancellation from server rejection. Do not log raw bodies, tokens, signatures or API keys.
126
+ Read the raw body, not parsed JSON, and pass it with the `x-octap-signature` header and your
127
+ endpoint's secret. `constructWebhookEvent` checks the signature and returns a `WebhookEvent` typed on
128
+ `type`. It throws `OctaSdkError` when the signature is missing or doesn't match. `verifyWebhookSignature` only checks it.
79
129
 
80
130
  ```ts
81
- const controller = new AbortController();
82
- await client.getBalance(memberId, { signal: controller.signal });
83
- // controller.abort() cancels local waiting; it does not roll back Core or the chain.
131
+ import { constructWebhookEvent } from '@octap/sdk';
132
+
133
+ app.post('/webhooks/octap', express.raw({ type: 'application/json' }), (req, res) => {
134
+ const event = constructWebhookEvent(req.body.toString('utf8'), req.header('x-octap-signature'), secret);
135
+ if (event.type === 'voucher.redeemed') deliverBenefit(event.data);
136
+ res.sendStatus(200);
137
+ });
84
138
  ```
85
139
 
86
- The SDK performs no automatic retries. Retry reads with bounded backoff, and wait `retryAfter` on a 429.
87
- For earn, reserve, reversal and claim retries, keep the same idempotency key and the same request: a
88
- retry returns the original transaction, and a changed request under a used key returns 409. After a timeout, cancellation,
89
- network failure or 5xx, read persisted state first, because the request may have committed. Never switch
90
- to a new key to recover an unknown outcome. Finalize must reuse the original signature and digest, or
91
- read the existing claim. Voucher redemption has no idempotency key: read its ownership status before
92
- retrying. Webhook registration and secret rotation are not idempotent, so do not blindly retry them.
140
+ Deduplicate on `event.id`: retries and replays keep the same id.
141
+
142
+ ## Errors, cancellation and retries
143
+
144
+ - **Errors.** `OctaApiError` exposes `statusCode`, `statusText`, `responseBody`, and `retryAfter`
145
+ when Core sent that header. `OctaNetworkError` keeps the original `cause`.
146
+ `OctaRequestAbortedError` tells a cancellation apart from a server rejection. All three extend
147
+ `OctaSdkError`. A **402** means the license: `LICENSE_LIMIT_REACHED`, `LICENSE_FEATURE_NOT_INCLUDED`
148
+ or `LICENSE_EXPIRED` (earns, POS reserves and paid claims); read it with `getLicense()`. Do not
149
+ log raw bodies, tokens, signatures or API keys.
150
+ - **Cancellation.**
151
+
152
+ ```ts
153
+ const controller = new AbortController();
154
+ await client.getBalance(memberId, { signal: controller.signal });
155
+ // controller.abort() stops waiting locally; it does not roll back Core or the chain.
156
+ ```
157
+
158
+ - **Retries.** The SDK never retries by itself.
159
+ - Retry reads with bounded backoff, and wait `retryAfter` on a 429.
160
+ - For an earn, a reserve, a reversal, a claim or a voucher use, retry with the same idempotency
161
+ key and the same request. A retry returns the original result. A changed request under a used
162
+ key is a 409.
163
+ - **Unknown outcomes.** After a timeout, a cancellation, a network failure or a 5xx, read the
164
+ persisted state first: the request may have committed. Never switch to a new key to recover from
165
+ an unknown outcome.
166
+ - **Finalize.** Reuse the original signature and digest, or read the existing claim or voucher.
package/dist/client.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import type { BalanceSnapshot, EarnPointsRequest, EarnPointsResponse, IssuanceBudgetDto, CreditBalanceSnapshot, LoyaltyTransactionPage, CreateVoucherRequest, UpdateVoucherRequest, VoucherDto, ClaimVoucherRequest, ClaimVoucherResponse, FinalizePosRedemptionRequest, FinalizePosRedemptionResponse, GrantVoucherRequest, PrepareVoucherUseRequest, PrepareVoucherUseResponse, FinalizeVoucherUseRequest, RedeemVoucherResponse, VoucherOwnershipDto, ListVoucherRefundPolicyHistoryRequest, VoucherRefundPolicyDto, VerifyCustomerResponse, ReservePosRedemptionRequest, ReservePosRedemptionResponse, ReverseTransactionRequest, ReverseTransactionResponse, WebhookEndpointDto, WebhookDeliveryDto, VoucherBatchActionResponse, CreateVoucherBatchResponse, ListVoucherBatchesRequest, VoucherBatchDetailDto, VoucherBatchDto, VoucherBatchItem } from '@octap/contracts';
1
+ import type { BalanceReconciliation, BalanceSnapshot, OrganizationTransactionQuery, ProgramEvidence, EarnPointsRequest, EarnPointsResponse, IssuanceBudgetDto, OrganizationLicenseDto, CreditBalanceSnapshot, LoyaltyTransactionPage, CreateVoucherRequest, UpdateVoucherRequest, VoucherDto, ClaimVoucherRequest, ClaimVoucherResponse, FinalizePosRedemptionRequest, FinalizePosRedemptionResponse, GrantVoucherRequest, PrepareVoucherUseRequest, PrepareVoucherUseResponse, FinalizeVoucherUseRequest, RedeemVoucherResponse, VoucherOwnershipDto, ListVoucherRefundPolicyHistoryRequest, VoucherRefundPolicyDto, VerifyCustomerResponse, ReservePosRedemptionRequest, ReservePosRedemptionResponse, ReverseTransactionRequest, ReverseTransactionResponse, WebhookEndpointDto, WebhookDeliveryDto, VoucherBatchActionResponse, CreateVoucherBatchResponse, ListVoucherBatchesRequest, VoucherBatchDetailDto, VoucherBatchDto, VoucherBatchItem, CampaignDto, ListCampaignsRequest } from '@octap/contracts';
2
2
  import type { Transport } from './transports/transport.js';
3
3
  export interface RequestOptions {
4
4
  organizationId?: string;
5
5
  signal?: AbortSignal;
6
6
  }
7
+ /** OctaP's API. Set `baseUrl` only to reach another Core, such as one running locally. */
8
+ export declare const DEFAULT_BASE_URL = "https://api.octap.biz";
7
9
  export interface OctaPointClientOptions {
8
10
  baseUrl?: string;
9
11
  transport?: Transport;
@@ -21,11 +23,11 @@ export declare class OctaPointClient {
21
23
  constructor(options?: OctaPointClientOptions);
22
24
  private request;
23
25
  /**
24
- * Checks the id_token your frontend got from the browser SDK's `getIdToken()`, like Firebase Admin
25
- * `verifyIdToken`. Writes nothing. `memberId` is null until the customer enrolls in your
26
- * organization, and `endUserId` is null if they have never signed in to OctaP.
26
+ * Checks the customer token your frontend got from the browser SDK's `getIdToken()`, like Firebase
27
+ * Admin `verifyIdToken`. Writes nothing. Core refuses (401) a token that expired or was issued for
28
+ * another organization than your API key's. `active` is whether reward operations accept the member.
27
29
  */
28
- verifyCustomer(idToken: string, options?: RequestOptions): Promise<VerifyCustomerResponse>;
30
+ verifyCustomer(token: string, options?: RequestOptions): Promise<VerifyCustomerResponse>;
29
31
  /**
30
32
  * Earn loyalty points for an organization member.
31
33
  */
@@ -37,6 +39,38 @@ export declare class OctaPointClient {
37
39
  getBalance(programId: string, memberId: string, options?: RequestOptions): Promise<BalanceSnapshot>;
38
40
  /** How many more points your program may issue, read live from the chain. */
39
41
  getIssuanceBudget(options?: RequestOptions): Promise<IssuanceBudgetDto>;
42
+ /**
43
+ * Your organization's license: its plan, until when, what it includes, and how much of each limit
44
+ * is in use. `license` is `null` if the organization has none.
45
+ */
46
+ getLicense(options?: RequestOptions): Promise<OrganizationLicenseDto>;
47
+ /**
48
+ * Your organization's points history, newest first: every member's earns, redemptions and
49
+ * reversals, each confirmed one with its Sui `blockchainDigest` and `confirmedAt`, so you can link
50
+ * a customer to the public proof. Filter by `type`, `status` or `memberId`, and by a time window
51
+ * with `from` (included) and `to` (excluded); pass `nextCursor` back as `cursor` for the next page.
52
+ * A cursor stays valid when its row's status changes.
53
+ */
54
+ listOrganizationTransactions(query?: OrganizationTransactionQuery, options?: RequestOptions): Promise<LoyaltyTransactionPage>;
55
+ /**
56
+ * Your program and the policy published for it on Sui (earn rate, expiry), compared with the
57
+ * rules OctaP applies: `policyStatus` is `MATCH` when they agree. Show it to customers as proof
58
+ * that the earn rules are the ones on the public ledger.
59
+ */
60
+ getProgram(options?: RequestOptions): Promise<ProgramEvidence>;
61
+ /**
62
+ * The organization's campaigns, newest first, archived ones left out. With `{ live: true }`, only
63
+ * those that boost an earn right now: show them at the till and send the pick as `campaignId` on
64
+ * `earnPoints`.
65
+ */
66
+ listCampaigns(query?: ListCampaignsRequest, options?: RequestOptions): Promise<CampaignDto[]>;
67
+ getCampaign(campaignId: string, options?: RequestOptions): Promise<CampaignDto>;
68
+ /**
69
+ * A member's balance as OctaP records it against what their `CreditAccount` on Sui can spend:
70
+ * `MATCH`, `PENDING` (something is still on its way to the chain; ask again shortly), `MISMATCH`, or
71
+ * `UNAVAILABLE` (the chain could not be read). Cached for up to 30 seconds.
72
+ */
73
+ getBalanceReconciliation(memberId: string, options?: RequestOptions): Promise<BalanceReconciliation>;
40
74
  /** Reserve POS points; return the bytes to the customer's signing session. */
41
75
  reservePosRedemption(request: ReservePosRedemptionRequest, options?: RequestOptions): Promise<ReservePosRedemptionResponse>;
42
76
  /** Submit the customer's signature. Cancellation does not undo a submitted transaction. */
@@ -44,11 +78,14 @@ export declare class OctaPointClient {
44
78
  reverseTransaction(request: ReverseTransactionRequest, options?: RequestOptions): Promise<ReverseTransactionResponse>;
45
79
  /**
46
80
  * One page of a member's loyalty transactions, newest first. `limit` 1–100 (default 25). Pass the
47
- * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page.
81
+ * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page. `from`
82
+ * (included) and `to` (excluded), ISO 8601 date-times with an offset or Z, keep a time window.
48
83
  */
49
84
  listTransactions(memberId: string, options?: RequestOptions & {
50
85
  limit?: number;
51
86
  cursor?: string;
87
+ from?: string;
88
+ to?: string;
52
89
  }): Promise<LoyaltyTransactionPage>;
53
90
  /** The policy the next published voucher takes. A published voucher keeps the one it was published with. */
54
91
  getVoucherRefundPolicy(options?: RequestOptions): Promise<VoucherRefundPolicyDto>;
@@ -84,6 +121,7 @@ export declare class OctaPointClient {
84
121
  createVouchers(items: VoucherBatchItem[], batchOptions?: {
85
122
  dryRun?: boolean;
86
123
  name?: string;
124
+ campaignId?: string;
87
125
  }, options?: RequestOptions): Promise<CreateVoucherBatchResponse>;
88
126
  /** Batches, newest first; archived ones only with `includeArchived`. */
89
127
  listVoucherBatches(query?: ListVoucherBatchesRequest, options?: RequestOptions): Promise<VoucherBatchDto[]>;
package/dist/client.js CHANGED
@@ -4,6 +4,8 @@ function toTransportError(err, signal) {
4
4
  ? new OctaRequestAbortedError(err)
5
5
  : new OctaNetworkError(err);
6
6
  }
7
+ /** OctaP's API. Set `baseUrl` only to reach another Core, such as one running locally. */
8
+ export const DEFAULT_BASE_URL = 'https://api.octap.biz';
7
9
  export class OctaPointClient {
8
10
  baseUrl;
9
11
  apiKey;
@@ -14,7 +16,7 @@ export class OctaPointClient {
14
16
  if (!resolvedBaseUrl && options.transport && options.transport.kind === 'rest') {
15
17
  resolvedBaseUrl = options.transport.baseUrl;
16
18
  }
17
- this.baseUrl = (resolvedBaseUrl ?? 'http://localhost:3000').replace(/\/+$/, '');
19
+ this.baseUrl = (resolvedBaseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
18
20
  this.apiKey = options.credentials?.apiKey;
19
21
  this.defaultOrganizationId = options.organizationId;
20
22
  if (options.fetchFn) {
@@ -87,12 +89,12 @@ export class OctaPointClient {
87
89
  // IDENTITY API
88
90
  // ==========================================
89
91
  /**
90
- * Checks the id_token your frontend got from the browser SDK's `getIdToken()`, like Firebase Admin
91
- * `verifyIdToken`. Writes nothing. `memberId` is null until the customer enrolls in your
92
- * organization, and `endUserId` is null if they have never signed in to OctaP.
92
+ * Checks the customer token your frontend got from the browser SDK's `getIdToken()`, like Firebase
93
+ * Admin `verifyIdToken`. Writes nothing. Core refuses (401) a token that expired or was issued for
94
+ * another organization than your API key's. `active` is whether reward operations accept the member.
93
95
  */
94
- async verifyCustomer(idToken, options) {
95
- return this.request('/v1/identity/verify', 'POST', { idToken }, options);
96
+ async verifyCustomer(token, options) {
97
+ return this.request('/v1/identity/verify', 'POST', { idToken: token }, options);
96
98
  }
97
99
  // ==========================================
98
100
  // POINTS & CREDITS API
@@ -122,6 +124,63 @@ export class OctaPointClient {
122
124
  async getIssuanceBudget(options) {
123
125
  return this.request('/v1/credits/budget', 'GET', undefined, options);
124
126
  }
127
+ /**
128
+ * Your organization's license: its plan, until when, what it includes, and how much of each limit
129
+ * is in use. `license` is `null` if the organization has none.
130
+ */
131
+ async getLicense(options) {
132
+ return this.request('/v1/license', 'GET', undefined, options);
133
+ }
134
+ // ==========================================
135
+ // ON-CHAIN EVIDENCE (OCT-334)
136
+ // ==========================================
137
+ /**
138
+ * Your organization's points history, newest first: every member's earns, redemptions and
139
+ * reversals, each confirmed one with its Sui `blockchainDigest` and `confirmedAt`, so you can link
140
+ * a customer to the public proof. Filter by `type`, `status` or `memberId`, and by a time window
141
+ * with `from` (included) and `to` (excluded); pass `nextCursor` back as `cursor` for the next page.
142
+ * A cursor stays valid when its row's status changes.
143
+ */
144
+ async listOrganizationTransactions(query = {}, options) {
145
+ return this.request('/v1/credits/transactions', 'GET', undefined, options, {
146
+ limit: query.limit,
147
+ cursor: query.cursor,
148
+ type: query.type,
149
+ status: query.status,
150
+ memberId: query.memberId,
151
+ from: query.from,
152
+ to: query.to,
153
+ });
154
+ }
155
+ /**
156
+ * Your program and the policy published for it on Sui (earn rate, expiry), compared with the
157
+ * rules OctaP applies: `policyStatus` is `MATCH` when they agree. Show it to customers as proof
158
+ * that the earn rules are the ones on the public ledger.
159
+ */
160
+ async getProgram(options) {
161
+ return this.request('/v1/credits/program', 'GET', undefined, options);
162
+ }
163
+ /**
164
+ * The organization's campaigns, newest first, archived ones left out. With `{ live: true }`, only
165
+ * those that boost an earn right now: show them at the till and send the pick as `campaignId` on
166
+ * `earnPoints`.
167
+ */
168
+ async listCampaigns(query = {}, options) {
169
+ return this.request('/v1/campaigns', 'GET', undefined, options, {
170
+ live: query.live === undefined ? undefined : String(query.live),
171
+ });
172
+ }
173
+ async getCampaign(campaignId, options) {
174
+ return this.request(`/v1/campaigns/${encodeURIComponent(campaignId)}`, 'GET', undefined, options);
175
+ }
176
+ /**
177
+ * A member's balance as OctaP records it against what their `CreditAccount` on Sui can spend:
178
+ * `MATCH`, `PENDING` (something is still on its way to the chain; ask again shortly), `MISMATCH`, or
179
+ * `UNAVAILABLE` (the chain could not be read). Cached for up to 30 seconds.
180
+ */
181
+ async getBalanceReconciliation(memberId, options) {
182
+ return this.request(`/v1/credits/members/${encodeURIComponent(memberId)}/reconciliation`, 'GET', undefined, options);
183
+ }
125
184
  /** Reserve POS points; return the bytes to the customer's signing session. */
126
185
  async reservePosRedemption(request, options) {
127
186
  return this.request('/v1/credits/redeem/reserve', 'POST', request, options);
@@ -136,10 +195,11 @@ export class OctaPointClient {
136
195
  }
137
196
  /**
138
197
  * One page of a member's loyalty transactions, newest first. `limit` 1–100 (default 25). Pass the
139
- * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page.
198
+ * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page. `from`
199
+ * (included) and `to` (excluded), ISO 8601 date-times with an offset or Z, keep a time window.
140
200
  */
141
201
  async listTransactions(memberId, options) {
142
- return this.request(`/v1/credits/members/${encodeURIComponent(memberId)}/transactions`, 'GET', undefined, options, { limit: options?.limit, cursor: options?.cursor });
202
+ return this.request(`/v1/credits/members/${encodeURIComponent(memberId)}/transactions`, 'GET', undefined, options, { limit: options?.limit, cursor: options?.cursor, from: options?.from, to: options?.to });
143
203
  }
144
204
  // ==========================================
145
205
  // REWARDS & VOUCHERS API
@@ -195,6 +255,7 @@ export class OctaPointClient {
195
255
  items,
196
256
  ...(batchOptions.dryRun !== undefined ? { dryRun: batchOptions.dryRun } : {}),
197
257
  ...(batchOptions.name !== undefined ? { name: batchOptions.name } : {}),
258
+ ...(batchOptions.campaignId !== undefined ? { campaignId: batchOptions.campaignId } : {}),
198
259
  }, options);
199
260
  }
200
261
  /** Batches, newest first; archived ones only with `includeArchived`. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE1G,SAAS,gBAAgB,CAAC,GAAY,EAAE,MAAoB;IAC1D,OAAO,MAAM,EAAE,OAAO,IAAI,CAAC,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;QAC3E,CAAC,CAAC,IAAI,uBAAuB,CAAC,GAAG,CAAC;QAClC,CAAC,CAAC,I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IAED,+FAA+F;IAC/F,KAAK,CAAC,qBAAqB,CAAC,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkC,EAAE;IACxE,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { OctaPointClient, createOctaPointClient, type OctaPointClientOptions, type RequestOptions } from './client.js';
1
+ export { DEFAULT_BASE_URL, OctaPointClient, createOctaPointClient, type OctaPointClientOptions, type RequestOptions, } from './client.js';
2
2
  export { OctaSdkError, OctaApiError, OctaNetworkError, OctaRequestAbortedError } from './errors/index.js';
3
3
  export { verifyWebhookSignature, constructWebhookEvent } from './webhooks.js';
4
4
  export { parseVoucherCsv, suggestVoucherCode, VOUCHER_BENEFIT_SCHEMA, VOUCHER_CSV_TEMPLATE, VOUCHER_CSV_TYPES, type ParsedVoucherCsv, type ParseVoucherCsvOptions, type VoucherBenefitKind, type VoucherCsvRow, } from './voucher-csv.js';
5
5
  export type { Transport, RestTransport } from './transports/transport.js';
6
- export type { Points, BalanceSnapshot, LoyaltyTxType, LoyaltyTxStatus, EarnPointsRequest, EarnPointsResponse, IssuanceBudgetDto, IssuanceBudgetShard, IssuanceBudgetTopUp, BudgetWarningThreshold, PosRedemptionBenefit, ReservePosRedemptionRequest, ReservePosRedemptionResponse, FinalizePosRedemptionRequest, FinalizePosRedemptionResponse, ReverseTransactionRequest, ReverseTransactionResponse, CreditBalanceSnapshot, LoyaltyTransactionDto, LoyaltyTransactionPage, VoucherRefundPolicy, VoucherRefundPolicySnapshot, SetVoucherRefundPolicyRequest, ListVoucherRefundPolicyHistoryRequest, VoucherRefundPolicyDto, VoucherStatus, VoucherOwnershipStatus, DiscountType, CreateVoucherRequest, UpdateVoucherRequest, VoucherDto, ClaimVoucherRequest, ClaimVoucherResponse, GrantVoucherRequest, PrepareVoucherUseRequest, PrepareVoucherUseResponse, FinalizeVoucherUseRequest, RedeemVoucherResponse, VoucherOwnershipDto, VoucherBatchSource, VoucherBatchItem, CreateVoucherBatchRequest, CreateVoucherBatchResponse, VoucherBatchItemErrorCode, VoucherBatchItemResult, VoucherFieldDifference, VoucherBatchDto, VoucherBatchStatusCounts, VoucherBatchDetailDto, ListVoucherBatchesRequest, VoucherBatchOutcome, VoucherBatchActivationOutcome, VoucherBatchActionResult, VoucherBatchActionResponse, WebhookEndpointStatus, WebhookDeliveryStatus, WebhookEndpointDto, WebhookEndpointWithSecretDto, RegisterWebhookEndpointRequest, WebhookDeliveryDto, WebhookEventType, WebhookEvent, CreditsEarnedEventData, CreditsChainConfirmedEventData, CreditsEarnFailedEventData, EarnFailureCode, BudgetLowEventData, } from '@octap/contracts';
6
+ export type { Points, BalanceSnapshot, LoyaltyTxType, LoyaltyTxStatus, EarnPointsRequest, EarnPointsResponse, IssuanceBudgetDto, OrganizationLicenseDto, LicenseDto, LicenseUsage, LicenseEntitlements, LicenseLimits, LicenseFeature, LicenseTier, LicenseState, LicenseSource, IssuanceBudgetShard, IssuanceBudgetTopUp, BudgetWarningThreshold, PosRedemptionBenefit, ReservePosRedemptionRequest, ReservePosRedemptionResponse, FinalizePosRedemptionRequest, FinalizePosRedemptionResponse, ReverseTransactionRequest, ReverseTransactionResponse, CreditBalanceSnapshot, LoyaltyTransactionDto, LoyaltyTransactionPage, OrganizationTransactionQuery, BalanceReconciliation, BalanceReconciliationStatus, ProgramEvidence, ProgramPolicyEvidence, VoucherRefundPolicy, VoucherRefundPolicySnapshot, SetVoucherRefundPolicyRequest, ListVoucherRefundPolicyHistoryRequest, VoucherRefundPolicyDto, VoucherStatus, VoucherOwnershipStatus, DiscountType, CreateVoucherRequest, UpdateVoucherRequest, VoucherDto, ClaimVoucherRequest, ClaimVoucherResponse, GrantVoucherRequest, PrepareVoucherUseRequest, PrepareVoucherUseResponse, FinalizeVoucherUseRequest, RedeemVoucherResponse, VoucherOwnershipDto, VoucherBatchSource, VoucherBatchItem, CreateVoucherBatchRequest, CreateVoucherBatchResponse, VoucherBatchItemErrorCode, VoucherBatchItemResult, VoucherFieldDifference, VoucherBatchDto, VoucherBatchStatusCounts, VoucherBatchDetailDto, ListVoucherBatchesRequest, VoucherBatchOutcome, VoucherBatchActivationOutcome, VoucherBatchActionResult, VoucherBatchActionResponse, WebhookEndpointStatus, WebhookDeliveryStatus, WebhookEndpointDto, WebhookEndpointWithSecretDto, RegisterWebhookEndpointRequest, WebhookDeliveryDto, WebhookEventType, WebhookEvent, CreditsEarnedEventData, CreditsChainConfirmedEventData, CreditsEarnFailedEventData, EarnFailureCode, BudgetLowEventData, VerifyCustomerResponse, } from '@octap/contracts';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { OctaPointClient, createOctaPointClient } from './client.js';
1
+ export { DEFAULT_BASE_URL, OctaPointClient, createOctaPointClient, } from './client.js';
2
2
  export { OctaSdkError, OctaApiError, OctaNetworkError, OctaRequestAbortedError } from './errors/index.js';
3
3
  export { verifyWebhookSignature, constructWebhookEvent } from './webhooks.js';
4
4
  export { parseVoucherCsv, suggestVoucherCode, VOUCHER_BENEFIT_SCHEMA, VOUCHER_CSV_TEMPLATE, VOUCHER_CSV_TYPES, } from './voucher-csv.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAoD,MAAM,aAAa,CAAC;AAEvH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE1G,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAKlB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,GAGtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE1G,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAKlB,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octap/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Server-side Node.js SDK for the Octap Core loyalty API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,10 +17,11 @@
17
17
  },
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.json",
20
+ "prepack": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\" && npm run build",
20
21
  "typecheck": "tsc -p tsconfig.json --noEmit"
21
22
  },
22
23
  "dependencies": {
23
- "@octap/contracts": "^0.2.0"
24
+ "@octap/contracts": "^0.3.0"
24
25
  },
25
26
  "files": [
26
27
  "dist",