@octap/sdk 0.3.0 → 0.5.1

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,80 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1
4
+
5
+ Types only: the requests sent are unchanged. Needs `@octap/contracts` 0.3.4 or later.
6
+
7
+ ### Added
8
+
9
+ - Several vouchers with one signature (OCT-218): `prepareVoucherUse({ serialCodes, idempotencyKey,
10
+ orderReference? })` prepares 1–5 of one customer's vouchers as one transaction they sign once, and
11
+ answers `PrepareVoucherUsesResponse`. `finalizeVoucherUse<RedeemVouchersResponse>()` reads the
12
+ list. One `serialCode` answers as before, plus `vouchers` and `orderReference`.
13
+
14
+ ## 0.5.0
15
+
16
+ Needs `@octap/contracts` 0.3.2 or later.
17
+
18
+ ### Added
19
+
20
+ - On-chain evidence for vouchers (OCT-328): `getVoucherTermsLedger(voucherId)` returns the Sui
21
+ transaction that froze a voucher's terms and the object holding them;
22
+ `getVoucherOwnershipLedger(memberId, voucherOwnershipId)` returns a member's voucher on Sui (issued,
23
+ latest use, refund), each step a `LedgerRecord`. `read` scope.
24
+ - Transactions from `listOrganizationTransactions`, `listTransactions` and the issuance budget's
25
+ `recentTopUps` carry a `ledger` record: whether the write reached Sui, its digest and when.
26
+
27
+ - Membership levels (OCT-408): `getMembership()` lists your levels, `getMemberLevel(memberId)` reads a
28
+ member's level and progress, and `setMemberLevel(memberId, { levelId, reason? })` sets or clears it.
29
+ Needs `@octap/contracts` with the membership types.
30
+ `setMemberLevel` is refused with 402 when the license doesn't include `membership.levels`, and with
31
+ 409 in own-code mode when the Owner set the member's level by hand.
32
+
33
+ ## 0.4.0
34
+
35
+ ### Changed
36
+
37
+ - Customer tokens are bound to one organization (OCT-394). `verifyCustomer(token)` takes the
38
+ customer token from `@octap/browser-sdk` 0.2's `getIdToken()`, no longer a Google id_token, and
39
+ answers 401 for a token issued for another organization than your API key's. Its result type,
40
+ `VerifyCustomerResponse`, is exported.
41
+ - `baseUrl` defaults to `https://api.octap.biz` (exported as `DEFAULT_BASE_URL`) instead of
42
+ `http://localhost:3000`.
43
+
44
+ ### Added
45
+
46
+ - `getLicense()` (OCT-329): your organization's license (plan, `startsAt`, `endsAt`, `state`
47
+ `ACTIVE`/`GRACE`/`EXPIRED`, what it includes) and how much of each limit is in use this license
48
+ month. `read` scope.
49
+ - License limits (OCT-329): a request the license doesn't cover answers **402** with `code`
50
+ `LICENSE_LIMIT_REACHED` (`limit`, `used`, `allowed`: the plan's limit) or `LICENSE_FEATURE_NOT_INCLUDED`
51
+ (`feature`). Earn, POS reserve and paid claims stop at 110% of the monthly transactions; voucher
52
+ batches need `voucher.batches`, sandbox keys need `sandbox`. Types: `LicenseErrorBody`,
53
+ `LicenseErrorCode`.
54
+ - Webhook `license.usage_threshold` (`LicenseUsageThresholdEventData`): sent once per license month
55
+ at 80% and at 100% of the monthly transactions.
56
+ - License expiry (OCT-329): 7 days after a license ends (its grace period), earns, POS reserves and
57
+ paid voucher claims answer **402 `LICENSE_EXPIRED`**; everything else keeps working. Webhook
58
+ `license.expiry_notice` (`LicenseExpiryNoticeEventData`) is sent 30, 7 and 1 days before the end,
59
+ when the grace period starts and when it is over (`stage`), once each. Types:
60
+ `LicenseExpiryStage`, `LICENSE_EXPIRY_STAGES`, `LICENSE_EXPIRY_REMINDER_DAYS`.
61
+ - License purchases (OCT-330): webhooks `license.activated`, `license.renewed` and `license.upgraded`
62
+ (`LicensePurchasedEventData`) when a bank transfer pays a license order, and
63
+ `license.payment_needs_attention` (`LicensePaymentNeedsAttentionEventData`) when one couldn't
64
+ (too little, expired, canceled or already paid). Types: `LicenseOrderDto`, `PaymentTransferStatus`,
65
+ `PaymentUnmatchedReason`.
66
+ - Campaigns (OCT-340): `earnPoints({ ..., campaignId })` applies an Owner's time-boxed campaign
67
+ multiplier (up to 10x, from the issuance budget); a campaign that isn't `ACTIVE`, is outside its
68
+ dates or has no multiplier is a 422, never an earn at the base rate. `createVouchers(items,
69
+ { campaignId })` puts a batch's vouchers in a campaign. `VoucherDto.campaignId`, and
70
+ `credits.earned` webhooks carry `campaignId` when a campaign boosted the earn. Needs
71
+ `@octap/contracts` with the campaign types.
72
+ - Transactions by date: `listOrganizationTransactions({ from, to })` and `listTransactions(memberId,
73
+ { from, to })` keep the transactions created from `from` (included) to `to` (excluded), ISO 8601
74
+ date-times with an offset or Z. Needs `@octap/contracts` with the `from`/`to` query fields.
75
+ - `listCampaigns({ live })` and `getCampaign(id)` (`GET /v1/campaigns`, `read` scope): a POS lists
76
+ the campaigns that boost an earn right now, so the cashier can pick one.
77
+
3
78
  ## 0.3.0
4
79
 
5
80
  ### Added
package/README.md CHANGED
@@ -10,14 +10,13 @@ npm install @octap/sdk
10
10
 
11
11
  ## Create a client
12
12
 
13
- Create one client and reuse it. Set `baseUrl` to your Octap Core API: without it, the client calls
14
- `http://localhost:3000`.
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
15
 
16
16
  ```ts
17
17
  import { createOctaPointClient } from '@octap/sdk';
18
18
 
19
19
  export const client = createOctaPointClient({
20
- baseUrl: process.env.OCTAP_API_URL,
21
20
  credentials: { apiKey: process.env.OCTAP_API_KEY },
22
21
  });
23
22
  ```
@@ -27,44 +26,51 @@ optional last argument, `RequestOptions`: `{ organizationId, signal }`.
27
26
 
28
27
  ## Verifying a customer
29
28
 
30
- Your frontend gets an id_token from the browser SDK and sends it to your backend. Check it before
31
- acting for that customer, as you would with 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`:
32
32
 
33
33
  ```ts
34
- const { suiAddress, memberId, active } = await client.verifyCustomer(idToken);
35
- if (!memberId) {
36
- // A valid Google sign-in that has not enrolled in your organization yet.
37
- } else if (!active) {
38
- // 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.
39
37
  }
40
38
  ```
41
39
 
42
- An invalid or expired token throws `OctaApiError` with status 401. The call needs the `read` scope
43
- and writes nothing. Every merchant shares one OctaP Google client ID, so a token a customer showed
44
- to another merchant also verifies here. Treat it as proof of who the customer is, not as consent to
45
- anything, and keep every spend behind the customer's signature.
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.
46
45
 
47
46
  ## Methods
48
47
 
49
48
  | Core routes | SDK methods |
50
49
  | --- | --- |
51
- | `POST /v1/identity/verify` | `verifyCustomer(idToken)` |
52
- | `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)` |
54
+ | `GET /v1/membership` | `getMembership()` |
55
+ | `GET /v1/membership/members/:id`, `PUT .../level` | `getMemberLevel(memberId)`, `setMemberLevel(memberId, { levelId, reason? })` |
53
56
  | `POST /v1/credits/redeem/reserve`, `/finalize` | `reservePosRedemption`, `finalizePosRedemption` |
54
57
  | `POST /v1/credits/transactions/:id/reverse` | `reverseTransaction` |
55
- | `GET /v1/credits/members/:id/balance`, `/transactions` | `getBalance`, `listTransactions` |
58
+ | `GET /v1/credits/members/:id/balance`, `/transactions` | `getBalance`, `listTransactions(memberId, { limit, cursor, from, to })` |
56
59
  | `GET /v1/credits/budget` | `getIssuanceBudget` |
57
- | `GET /v1/credits/transactions` | `listOrganizationTransactions({ type, status, memberId, limit, cursor })` |
60
+ | `GET /v1/license` | `getLicense` |
61
+ | `GET /v1/credits/transactions` | `listOrganizationTransactions({ type, status, memberId, from, to, limit, cursor })` |
58
62
  | `GET /v1/credits/program` | `getProgram` |
59
63
  | `GET /v1/credits/members/:id/reconciliation` | `getBalanceReconciliation` |
60
64
  | `GET /v1/rewards/refund-policy`, `GET .../history` | `getVoucherRefundPolicy`, `listVoucherRefundPolicyHistory` |
61
65
  | `POST/GET /v1/rewards/vouchers`, `GET/PATCH .../:id` | `createVoucher`, `listVouchers`, `getVoucher`, `updateVoucher` |
62
- | `POST/GET /v1/rewards/voucher-batches`, `GET .../:id` | `createVouchers(items, { dryRun, name })`, `listVoucherBatches`, `getVoucherBatch` |
66
+ | `POST/GET /v1/rewards/voucher-batches`, `GET .../:id` | `createVouchers(items, { dryRun, name, campaignId })`, `listVoucherBatches`, `getVoucherBatch` |
63
67
  | `POST .../voucher-batches/:id/activate`, `/pause`, `/resume`, `/archive` | `activateVoucherBatch`, `pauseVoucherBatch`, `resumeVoucherBatch`, `archiveVoucherBatch` |
64
68
  | `POST .../vouchers/:id/claim`, `GET .../claims/:id` | `claimVoucher`, `getVoucherClaim` |
65
69
  | `POST .../vouchers/:id/grant` | `grantVoucher` |
66
70
  | `POST .../vouchers/use`, `/use/finalize` | `prepareVoucherUse`, `finalizeVoucherUse` |
67
71
  | `GET .../members/:id/vouchers` | `listMemberVouchers` |
72
+ | `GET .../vouchers/:id/ledger` | `getVoucherTermsLedger` |
73
+ | `GET .../members/:id/vouchers/:ownershipId/ledger` | `getVoucherOwnershipLedger` |
68
74
  | `GET /v1/webhooks/endpoints` | `listWebhookEndpoints` |
69
75
  | `GET /v1/webhooks/deliveries` | `listWebhookDeliveries` |
70
76
 
@@ -96,6 +102,10 @@ or check it yourself:
96
102
  - `getBalanceReconciliation(memberId)` compares the balance OctaP records with what the member's
97
103
  `CreditAccount` on Sui can spend. `PENDING` means something is still on its way to the chain, so ask
98
104
  again shortly. `MISMATCH` means nothing is in flight and the two differ.
105
+ - `getVoucherTermsLedger(voucherId)` returns the Sui transaction that froze a voucher's terms when it
106
+ went live, and the object holding them. `getVoucherOwnershipLedger(memberId, ownershipId)` returns a
107
+ member's voucher on Sui: how it was issued, its latest use and any refund. Every record carries
108
+ `status`, `digest` and `confirmedAt`; it is `CONFIRMED` only once Sui accepted it.
99
109
 
100
110
  ## Earn
101
111
 
@@ -142,7 +152,9 @@ Deduplicate on `event.id`: retries and replays keep the same id.
142
152
  - **Errors.** `OctaApiError` exposes `statusCode`, `statusText`, `responseBody`, and `retryAfter`
143
153
  when Core sent that header. `OctaNetworkError` keeps the original `cause`.
144
154
  `OctaRequestAbortedError` tells a cancellation apart from a server rejection. All three extend
145
- `OctaSdkError`. Do not log raw bodies, tokens, signatures or API keys.
155
+ `OctaSdkError`. A **402** means the license: `LICENSE_LIMIT_REACHED`, `LICENSE_FEATURE_NOT_INCLUDED`
156
+ or `LICENSE_EXPIRED` (earns, POS reserves and paid claims); read it with `getLicense()`. Do not
157
+ log raw bodies, tokens, signatures or API keys.
146
158
  - **Cancellation.**
147
159
 
148
160
  ```ts
package/dist/client.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import type { BalanceReconciliation, BalanceSnapshot, OrganizationTransactionQuery, ProgramEvidence, 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, PrepareVoucherUsesRequest, PrepareVoucherUsesResponse, FinalizeVoucherUseRequest, RedeemVoucherResponse, RedeemVouchersResponse, VoucherOwnershipDto, ListVoucherRefundPolicyHistoryRequest, VoucherRefundPolicyDto, VerifyCustomerResponse, ReservePosRedemptionRequest, ReservePosRedemptionResponse, ReverseTransactionRequest, ReverseTransactionResponse, WebhookEndpointDto, WebhookDeliveryDto, VoucherBatchActionResponse, CreateVoucherBatchResponse, ListVoucherBatchesRequest, VoucherBatchDetailDto, VoucherBatchDto, VoucherBatchItem, CampaignDto, ListCampaignsRequest, MembershipProgressDto, MembershipSettingsDto, SetMembershipLevelInput, VoucherTermsEvidence, VoucherOwnershipEvidence } 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,11 +39,17 @@ 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>;
40
47
  /**
41
48
  * Your organization's points history, newest first: every member's earns, redemptions and
42
49
  * reversals, each confirmed one with its Sui `blockchainDigest` and `confirmedAt`, so you can link
43
- * a customer to the public proof. Filter by `type`, `status` or `memberId`; pass `nextCursor` back
44
- * as `cursor` for the next page. A cursor stays valid when its row's status changes.
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.
45
53
  */
46
54
  listOrganizationTransactions(query?: OrganizationTransactionQuery, options?: RequestOptions): Promise<LoyaltyTransactionPage>;
47
55
  /**
@@ -50,12 +58,43 @@ export declare class OctaPointClient {
50
58
  * that the earn rules are the ones on the public ledger.
51
59
  */
52
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
+ /** The organization's membership levels, lowest first. None while the feature is off. */
69
+ getMembership(options?: RequestOptions): Promise<MembershipSettingsDto>;
70
+ /** A member's level and how far the next one is. */
71
+ getMemberLevel(memberId: string, options?: RequestOptions): Promise<MembershipProgressDto>;
72
+ /**
73
+ * Sets a member's level, or clears it with `levelId: null`. In own-code mode this is how your level
74
+ * reaches OctaP. While OctaP runs the levels, it counts as set by hand: the rules leave it alone.
75
+ */
76
+ setMemberLevel(memberId: string, input: SetMembershipLevelInput, options?: RequestOptions): Promise<MembershipProgressDto>;
53
77
  /**
54
78
  * A member's balance as OctaP records it against what their `CreditAccount` on Sui can spend:
55
79
  * `MATCH`, `PENDING` (something is still on its way to the chain; ask again shortly), `MISMATCH`, or
56
80
  * `UNAVAILABLE` (the chain could not be read). Cached for up to 30 seconds.
57
81
  */
58
82
  getBalanceReconciliation(memberId: string, options?: RequestOptions): Promise<BalanceReconciliation>;
83
+ /**
84
+ * The public record behind a voucher's terms: `published` is the Sui transaction that froze them
85
+ * when the voucher went live (`status` `PENDING`, `CONFIRMED` or `FAILED`, with its `digest` and
86
+ * `confirmedAt`), and `termsObjectId` the Sui object that holds them. `published` is `null` for a
87
+ * voucher that never went live. Link `digest` or `termsObjectId` to a Sui explorer to show a
88
+ * customer the terms nobody can change.
89
+ */
90
+ getVoucherTermsLedger(voucherId: string, options?: RequestOptions): Promise<VoucherTermsEvidence>;
91
+ /**
92
+ * The public record behind one member's voucher: `issued` (the paid claim or the free grant),
93
+ * `used` (its latest use) and `refunded` (the refund of a paid claim), each `null` until it
94
+ * happens, plus the member's `creditAccountId` and the voucher's `termsObjectId` on Sui. A record
95
+ * is `CONFIRMED` only once Sui accepted it, so a customer can check every step themselves.
96
+ */
97
+ getVoucherOwnershipLedger(memberId: string, voucherOwnershipId: string, options?: RequestOptions): Promise<VoucherOwnershipEvidence>;
59
98
  /** Reserve POS points; return the bytes to the customer's signing session. */
60
99
  reservePosRedemption(request: ReservePosRedemptionRequest, options?: RequestOptions): Promise<ReservePosRedemptionResponse>;
61
100
  /** Submit the customer's signature. Cancellation does not undo a submitted transaction. */
@@ -63,11 +102,14 @@ export declare class OctaPointClient {
63
102
  reverseTransaction(request: ReverseTransactionRequest, options?: RequestOptions): Promise<ReverseTransactionResponse>;
64
103
  /**
65
104
  * One page of a member's loyalty transactions, newest first. `limit` 1–100 (default 25). Pass the
66
- * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page.
105
+ * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page. `from`
106
+ * (included) and `to` (excluded), ISO 8601 date-times with an offset or Z, keep a time window.
67
107
  */
68
108
  listTransactions(memberId: string, options?: RequestOptions & {
69
109
  limit?: number;
70
110
  cursor?: string;
111
+ from?: string;
112
+ to?: string;
71
113
  }): Promise<LoyaltyTransactionPage>;
72
114
  /** The policy the next published voucher takes. A published voucher keeps the one it was published with. */
73
115
  getVoucherRefundPolicy(options?: RequestOptions): Promise<VoucherRefundPolicyDto>;
@@ -103,6 +145,7 @@ export declare class OctaPointClient {
103
145
  createVouchers(items: VoucherBatchItem[], batchOptions?: {
104
146
  dryRun?: boolean;
105
147
  name?: string;
148
+ campaignId?: string;
106
149
  }, options?: RequestOptions): Promise<CreateVoucherBatchResponse>;
107
150
  /** Batches, newest first; archived ones only with `includeArchived`. */
108
151
  listVoucherBatches(query?: ListVoucherBatchesRequest, options?: RequestOptions): Promise<VoucherBatchDto[]>;
@@ -147,10 +190,18 @@ export declare class OctaPointClient {
147
190
  /**
148
191
  * Ask the customer to use a voucher. Returns bytes for their device to sign: your API key cannot
149
192
  * mark a voucher used. Deliver the benefit on the `voucher.redeemed` webhook.
193
+ *
194
+ * Send `serialCodes` (1–5) to use several of one customer's vouchers on one order: they sign once,
195
+ * and the chain marks all of them used or none. Each still gets its own `voucher.redeemed`, sharing
196
+ * the digest and your `orderReference`. Which vouchers combine, and the discount, stay with you.
150
197
  */
151
198
  prepareVoucherUse(request: PrepareVoucherUseRequest, options?: RequestOptions): Promise<PrepareVoucherUseResponse>;
152
- /** The customer signs the returned bytes with their zkLogin session; finalize needs no merchant key. */
153
- finalizeVoucherUse(request: FinalizeVoucherUseRequest, options?: RequestOptions): Promise<RedeemVoucherResponse>;
199
+ prepareVoucherUse(request: PrepareVoucherUsesRequest, options?: RequestOptions): Promise<PrepareVoucherUsesResponse>;
200
+ /**
201
+ * The customer signs the returned bytes with their zkLogin session; finalize needs no merchant key.
202
+ * A use of several vouchers answers `RedeemVouchersResponse`: pass it as the type argument.
203
+ */
204
+ finalizeVoucherUse<T extends RedeemVouchersResponse = RedeemVoucherResponse>(request: FinalizeVoucherUseRequest, options?: RequestOptions): Promise<T>;
154
205
  /**
155
206
  * List all vouchers claimed/owned by a member.
156
207
  */
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,14 +124,22 @@ 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
+ }
125
134
  // ==========================================
126
135
  // ON-CHAIN EVIDENCE (OCT-334)
127
136
  // ==========================================
128
137
  /**
129
138
  * Your organization's points history, newest first: every member's earns, redemptions and
130
139
  * reversals, each confirmed one with its Sui `blockchainDigest` and `confirmedAt`, so you can link
131
- * a customer to the public proof. Filter by `type`, `status` or `memberId`; pass `nextCursor` back
132
- * as `cursor` for the next page. A cursor stays valid when its row's status changes.
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.
133
143
  */
134
144
  async listOrganizationTransactions(query = {}, options) {
135
145
  return this.request('/v1/credits/transactions', 'GET', undefined, options, {
@@ -138,6 +148,8 @@ export class OctaPointClient {
138
148
  type: query.type,
139
149
  status: query.status,
140
150
  memberId: query.memberId,
151
+ from: query.from,
152
+ to: query.to,
141
153
  });
142
154
  }
143
155
  /**
@@ -148,6 +160,34 @@ export class OctaPointClient {
148
160
  async getProgram(options) {
149
161
  return this.request('/v1/credits/program', 'GET', undefined, options);
150
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
+ /** The organization's membership levels, lowest first. None while the feature is off. */
177
+ async getMembership(options) {
178
+ return this.request('/v1/membership', 'GET', undefined, options);
179
+ }
180
+ /** A member's level and how far the next one is. */
181
+ async getMemberLevel(memberId, options) {
182
+ return this.request(`/v1/membership/members/${encodeURIComponent(memberId)}`, 'GET', undefined, options);
183
+ }
184
+ /**
185
+ * Sets a member's level, or clears it with `levelId: null`. In own-code mode this is how your level
186
+ * reaches OctaP. While OctaP runs the levels, it counts as set by hand: the rules leave it alone.
187
+ */
188
+ async setMemberLevel(memberId, input, options) {
189
+ return this.request(`/v1/membership/members/${encodeURIComponent(memberId)}/level`, 'PUT', input, options);
190
+ }
151
191
  /**
152
192
  * A member's balance as OctaP records it against what their `CreditAccount` on Sui can spend:
153
193
  * `MATCH`, `PENDING` (something is still on its way to the chain; ask again shortly), `MISMATCH`, or
@@ -156,6 +196,25 @@ export class OctaPointClient {
156
196
  async getBalanceReconciliation(memberId, options) {
157
197
  return this.request(`/v1/credits/members/${encodeURIComponent(memberId)}/reconciliation`, 'GET', undefined, options);
158
198
  }
199
+ /**
200
+ * The public record behind a voucher's terms: `published` is the Sui transaction that froze them
201
+ * when the voucher went live (`status` `PENDING`, `CONFIRMED` or `FAILED`, with its `digest` and
202
+ * `confirmedAt`), and `termsObjectId` the Sui object that holds them. `published` is `null` for a
203
+ * voucher that never went live. Link `digest` or `termsObjectId` to a Sui explorer to show a
204
+ * customer the terms nobody can change.
205
+ */
206
+ async getVoucherTermsLedger(voucherId, options) {
207
+ return this.request(`/v1/rewards/vouchers/${encodeURIComponent(voucherId)}/ledger`, 'GET', undefined, options);
208
+ }
209
+ /**
210
+ * The public record behind one member's voucher: `issued` (the paid claim or the free grant),
211
+ * `used` (its latest use) and `refunded` (the refund of a paid claim), each `null` until it
212
+ * happens, plus the member's `creditAccountId` and the voucher's `termsObjectId` on Sui. A record
213
+ * is `CONFIRMED` only once Sui accepted it, so a customer can check every step themselves.
214
+ */
215
+ async getVoucherOwnershipLedger(memberId, voucherOwnershipId, options) {
216
+ return this.request(`/v1/rewards/members/${encodeURIComponent(memberId)}/vouchers/${encodeURIComponent(voucherOwnershipId)}/ledger`, 'GET', undefined, options);
217
+ }
159
218
  /** Reserve POS points; return the bytes to the customer's signing session. */
160
219
  async reservePosRedemption(request, options) {
161
220
  return this.request('/v1/credits/redeem/reserve', 'POST', request, options);
@@ -170,10 +229,11 @@ export class OctaPointClient {
170
229
  }
171
230
  /**
172
231
  * One page of a member's loyalty transactions, newest first. `limit` 1–100 (default 25). Pass the
173
- * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page.
232
+ * returned `nextCursor` as `cursor` for the next page; it is `null` on the last page. `from`
233
+ * (included) and `to` (excluded), ISO 8601 date-times with an offset or Z, keep a time window.
174
234
  */
175
235
  async listTransactions(memberId, options) {
176
- return this.request(`/v1/credits/members/${encodeURIComponent(memberId)}/transactions`, 'GET', undefined, options, { limit: options?.limit, cursor: options?.cursor });
236
+ return this.request(`/v1/credits/members/${encodeURIComponent(memberId)}/transactions`, 'GET', undefined, options, { limit: options?.limit, cursor: options?.cursor, from: options?.from, to: options?.to });
177
237
  }
178
238
  // ==========================================
179
239
  // REWARDS & VOUCHERS API
@@ -229,6 +289,7 @@ export class OctaPointClient {
229
289
  items,
230
290
  ...(batchOptions.dryRun !== undefined ? { dryRun: batchOptions.dryRun } : {}),
231
291
  ...(batchOptions.name !== undefined ? { name: batchOptions.name } : {}),
292
+ ...(batchOptions.campaignId !== undefined ? { campaignId: batchOptions.campaignId } : {}),
232
293
  }, options);
233
294
  }
234
295
  /** Batches, newest first; archived ones only with `includeArchived`. */
@@ -293,14 +354,13 @@ export class OctaPointClient {
293
354
  async grantVoucher(voucherId, request, options) {
294
355
  return this.request(`/v1/rewards/vouchers/${encodeURIComponent(voucherId)}/grant`, 'POST', request, options);
295
356
  }
296
- /**
297
- * Ask the customer to use a voucher. Returns bytes for their device to sign: your API key cannot
298
- * mark a voucher used. Deliver the benefit on the `voucher.redeemed` webhook.
299
- */
300
357
  async prepareVoucherUse(request, options) {
301
358
  return this.request('/v1/rewards/vouchers/use', 'POST', request, options);
302
359
  }
303
- /** The customer signs the returned bytes with their zkLogin session; finalize needs no merchant key. */
360
+ /**
361
+ * The customer signs the returned bytes with their zkLogin session; finalize needs no merchant key.
362
+ * A use of several vouchers answers `RedeemVouchersResponse`: pass it as the type argument.
363
+ */
304
364
  async finalizeVoucherUse(request, options) {
305
365
  return this.request('/v1/rewards/vouchers/use/finalize', 'POST', request, options);
306
366
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAwCA,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,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E,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAI,mCAAmC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,OAAwB;QACjE,OAAO,IAAI,CAAC,OAAO,CACjB,uBAAuB,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAC9D,KAAK,EACL,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,oBAAoB,CAAC,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;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, 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, } 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.3.0",
3
+ "version": "0.5.1",
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.4"
24
25
  },
25
26
  "files": [
26
27
  "dist",