@peable.to/sdk 0.2.7-oxy-one.1 → 0.3.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/dist/cjs/contributions.js +10 -0
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/resources/billing.js +8 -0
- package/dist/esm/contributions.js +6 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/resources/billing.js +8 -0
- package/dist/types/contributions.d.ts +2 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/resources/billing.d.ts +6 -1
- package/package.json +15 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContributionsResource = void 0;
|
|
4
|
+
// Browser entry (`@peable.to/sdk/contributions`) — organization contribution
|
|
5
|
+
// management over a caller-supplied transport (the wallet's Oxy linked client).
|
|
6
|
+
// Deliberately separate from the server entry, which carries the merchant-authed
|
|
7
|
+
// service-token and billing-verification code (`node:crypto`) a browser or
|
|
8
|
+
// React Native bundle must never pull in.
|
|
9
|
+
var contributions_1 = require("./resources/contributions");
|
|
10
|
+
Object.defineProperty(exports, "ContributionsResource", { enumerable: true, get: function () { return contributions_1.ContributionsResource; } });
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContributionsResource = exports.WebhooksResource = exports.WEBHOOK_SIGNATURE_HEADER = exports.PeableSignatureVerificationError = exports.PeableApiError = exports.PeablePermissionError = exports.PeableInvalidRequestError = exports.PeableAuthenticationError = exports.PeableError = exports.DEFAULT_OXY_API_URL = exports.DEFAULT_GATEWAY_BASE_URL = exports.Peable = void 0;
|
|
3
|
+
exports.ContributionsResource = exports.WebhooksResource = exports.WEBHOOK_SIGNATURE_HEADER = exports.PeableSignatureVerificationError = exports.PeableApiError = exports.PeablePermissionError = exports.PeableInvalidRequestError = exports.PeableAuthenticationError = exports.PeableError = exports.DEFAULT_OXY_API_URL = exports.DEFAULT_GATEWAY_BASE_URL = exports.Peable = exports.PEABLE_BILLING_AUTHORITY_KEYS = void 0;
|
|
4
4
|
const billing_1 = require("./resources/billing");
|
|
5
|
+
/** Production Peable's pinned billing-authority public keys, by key id. */
|
|
6
|
+
var shared_types_1 = require("@peable.to/shared-types");
|
|
7
|
+
Object.defineProperty(exports, "PEABLE_BILLING_AUTHORITY_KEYS", { enumerable: true, get: function () { return shared_types_1.PEABLE_BILLING_AUTHORITY_KEYS; } });
|
|
5
8
|
// Server entry (`@peable.to/sdk`) — the merchant-authed SDK. Configured with a
|
|
6
9
|
// confidential `ApplicationCredential` (`{publicKey, secret}`), from which it
|
|
7
10
|
// mints and caches an Oxy service token, or with a caller-supplied
|
|
@@ -10,6 +10,13 @@ class BillingResource {
|
|
|
10
10
|
this.invoiceAuthorityKeys = invoiceAuthorityKeys;
|
|
11
11
|
this.taxQuoteAuthorityKeys = taxQuoteAuthorityKeys;
|
|
12
12
|
}
|
|
13
|
+
/** The rails this merchant's payers can choose between (card and other fiat
|
|
14
|
+
* providers, FairCoin), default first, with each rail's offers. Pass the
|
|
15
|
+
* payer's choice as `rail` to `ensureCustomer`; the customer's rail then
|
|
16
|
+
* carries its checkouts, subscriptions and invoices. */
|
|
17
|
+
listRails() {
|
|
18
|
+
return this.client.request('GET', '/v1/billing/rails');
|
|
19
|
+
}
|
|
13
20
|
ensureCustomer(params, options) {
|
|
14
21
|
return this.client.request('POST', '/v1/billing/customers', {
|
|
15
22
|
body: params,
|
|
@@ -115,6 +122,7 @@ class BillingResource {
|
|
|
115
122
|
// delayed webhook must remain recoverable after the original quote expires.
|
|
116
123
|
if (authority.method === 'faircoin') {
|
|
117
124
|
const paid = await this.retrievePaidInvoice(subscriptionRef, invoiceRef);
|
|
125
|
+
// biome-ignore lint/style/noNonNullAssertion: FairCoin quote presence and bounds were verified above before signature verification.
|
|
118
126
|
const quote = authority.invoice.faircoinQuote;
|
|
119
127
|
const paidAt = Date.parse(paid.paidAt);
|
|
120
128
|
if (paid.invoiceId !== invoiceRef ||
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Browser entry (`@peable.to/sdk/contributions`) — organization contribution
|
|
2
|
+
// management over a caller-supplied transport (the wallet's Oxy linked client).
|
|
3
|
+
// Deliberately separate from the server entry, which carries the merchant-authed
|
|
4
|
+
// service-token and billing-verification code (`node:crypto`) a browser or
|
|
5
|
+
// React Native bundle must never pull in.
|
|
6
|
+
export { ContributionsResource } from './resources/contributions.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BillingResource } from './resources/billing.js';
|
|
2
|
+
/** Production Peable's pinned billing-authority public keys, by key id. */
|
|
3
|
+
export { PEABLE_BILLING_AUTHORITY_KEYS } from '@peable.to/shared-types';
|
|
2
4
|
// Server entry (`@peable.to/sdk`) — the merchant-authed SDK. Configured with a
|
|
3
5
|
// confidential `ApplicationCredential` (`{publicKey, secret}`), from which it
|
|
4
6
|
// mints and caches an Oxy service token, or with a caller-supplied
|
|
@@ -7,6 +7,13 @@ export class BillingResource {
|
|
|
7
7
|
this.invoiceAuthorityKeys = invoiceAuthorityKeys;
|
|
8
8
|
this.taxQuoteAuthorityKeys = taxQuoteAuthorityKeys;
|
|
9
9
|
}
|
|
10
|
+
/** The rails this merchant's payers can choose between (card and other fiat
|
|
11
|
+
* providers, FairCoin), default first, with each rail's offers. Pass the
|
|
12
|
+
* payer's choice as `rail` to `ensureCustomer`; the customer's rail then
|
|
13
|
+
* carries its checkouts, subscriptions and invoices. */
|
|
14
|
+
listRails() {
|
|
15
|
+
return this.client.request('GET', '/v1/billing/rails');
|
|
16
|
+
}
|
|
10
17
|
ensureCustomer(params, options) {
|
|
11
18
|
return this.client.request('POST', '/v1/billing/customers', {
|
|
12
19
|
body: params,
|
|
@@ -112,6 +119,7 @@ export class BillingResource {
|
|
|
112
119
|
// delayed webhook must remain recoverable after the original quote expires.
|
|
113
120
|
if (authority.method === 'faircoin') {
|
|
114
121
|
const paid = await this.retrievePaidInvoice(subscriptionRef, invoiceRef);
|
|
122
|
+
// biome-ignore lint/style/noNonNullAssertion: FairCoin quote presence and bounds were verified above before signature verification.
|
|
115
123
|
const quote = authority.invoice.faircoinQuote;
|
|
116
124
|
const paidAt = Date.parse(paid.paidAt);
|
|
117
125
|
if (paid.invoiceId !== invoiceRef ||
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BillingResource } from './resources/billing';
|
|
2
2
|
export type { BillingRequestOptions } from './resources/billing';
|
|
3
|
-
export type { CreateBillingTaxQuoteParams, BillingTaxQuote, BillingInvoiceAuthoritySource, BillingFinalInvoice, BillingFinalInvoiceAuthority, BillingFaircoinRenewalChoice, BillingFaircoinRenewalConsent, BillingFaircoinRenewalRevocation, BillingObservation, BillingCustomer, BillingHostedSession, BillingCheckoutSession, BillingCheckoutObservation, RetrieveBillingCheckoutOperationParams, BillingCheckoutOperationSource, BillingCheckoutOperationRecovery, BillingPaidInvoice, BillingInvoiceState, BillingSubscription, CreateBillingCheckoutParams, CreateBillingPortalParams, EnsureBillingCustomerParams, } from '@peable.to/shared-types';
|
|
3
|
+
export type { CreateBillingTaxQuoteParams, BillingTaxQuote, BillingInvoiceAuthoritySource, BillingFinalInvoice, BillingFinalInvoiceAuthority, BillingFaircoinRenewalChoice, BillingFaircoinRenewalConsent, BillingFaircoinRenewalRevocation, BillingObservation, BillingCustomer, BillingHostedSession, BillingCheckoutSession, BillingCheckoutObservation, RetrieveBillingCheckoutOperationParams, BillingCheckoutOperationSource, BillingCheckoutOperationRecovery, BillingPaidInvoice, BillingInvoiceState, BillingSubscription, CreateBillingCheckoutParams, CreateBillingPortalParams, EnsureBillingCustomerParams, BillingRail, BillingRailSettlement, BillingRailOffer, BillingRailOption, BillingRailList, } from '@peable.to/shared-types';
|
|
4
|
+
/** Production Peable's pinned billing-authority public keys, by key id. */
|
|
5
|
+
export { PEABLE_BILLING_AUTHORITY_KEYS } from '@peable.to/shared-types';
|
|
4
6
|
import { type PeableConfig } from './core/config';
|
|
5
7
|
import { PaymentIntentsResource } from './resources/paymentIntents';
|
|
6
8
|
import { PaymentLinksResource } from './resources/paymentLinks';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BillingTaxQuote, RetrieveBillingCheckoutOperationParams, BillingCheckoutOperationRecovery, CreateBillingTaxQuoteParams, BillingFinalInvoiceAuthority, BillingCustomer, BillingHostedSession, BillingCheckoutSession, BillingCheckoutObservation, BillingPaidInvoice, BillingInvoiceState, BillingSubscription, CreateBillingCheckoutParams, CreateBillingPortalParams, EnsureBillingCustomerParams } from '@peable.to/shared-types';
|
|
1
|
+
import type { BillingTaxQuote, RetrieveBillingCheckoutOperationParams, BillingCheckoutOperationRecovery, CreateBillingTaxQuoteParams, BillingFinalInvoiceAuthority, BillingCustomer, BillingRailList, BillingHostedSession, BillingCheckoutSession, BillingCheckoutObservation, BillingPaidInvoice, BillingInvoiceState, BillingSubscription, CreateBillingCheckoutParams, CreateBillingPortalParams, EnsureBillingCustomerParams } from '@peable.to/shared-types';
|
|
2
2
|
import type { RestClient } from '../core/client';
|
|
3
3
|
export interface BillingRequestOptions {
|
|
4
4
|
idempotencyKey: string;
|
|
@@ -9,6 +9,11 @@ export declare class BillingResource {
|
|
|
9
9
|
private readonly invoiceAuthorityKeys?;
|
|
10
10
|
private readonly taxQuoteAuthorityKeys?;
|
|
11
11
|
constructor(client: RestClient, invoiceAuthorityKeys?: Readonly<Record<string, string>> | undefined, taxQuoteAuthorityKeys?: Readonly<Record<string, string>> | undefined);
|
|
12
|
+
/** The rails this merchant's payers can choose between (card and other fiat
|
|
13
|
+
* providers, FairCoin), default first, with each rail's offers. Pass the
|
|
14
|
+
* payer's choice as `rail` to `ensureCustomer`; the customer's rail then
|
|
15
|
+
* carries its checkouts, subscriptions and invoices. */
|
|
16
|
+
listRails(): Promise<BillingRailList>;
|
|
12
17
|
ensureCustomer(params: EnsureBillingCustomerParams, options: BillingRequestOptions): Promise<BillingCustomer>;
|
|
13
18
|
/** Pass the complete signed taxQuote to opt into fiscal checkout. Peable validates
|
|
14
19
|
* its pinned authority and retains immutable evidence before creating a session.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peable.to/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Peable SDK — a Stripe-ergonomics TypeScript client over the Peable Gateway REST + realtime contract. Server entry (`@peable.to/sdk`) mints Oxy service tokens from an ApplicationCredential and exposes paymentIntents/paymentLinks/checkout.sessions/webhooks; browser entry (`@peable.to/sdk/checkout`) is the anonymous payer-side client core.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"registry": "https://registry.npmjs.org/"
|
|
13
|
-
"tag": "oxy-one"
|
|
12
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
13
|
},
|
|
15
14
|
"exports": {
|
|
16
15
|
".": {
|
|
@@ -44,6 +43,18 @@
|
|
|
44
43
|
"types": "./dist/types/display.d.ts",
|
|
45
44
|
"default": "./dist/esm/display.js"
|
|
46
45
|
}
|
|
46
|
+
},
|
|
47
|
+
"./contributions": {
|
|
48
|
+
"react-native": "./dist/esm/contributions.js",
|
|
49
|
+
"import": {
|
|
50
|
+
"types": "./dist/types/contributions.d.ts",
|
|
51
|
+
"default": "./dist/esm/contributions.js"
|
|
52
|
+
},
|
|
53
|
+
"require": {
|
|
54
|
+
"types": "./dist/types/contributions.d.ts",
|
|
55
|
+
"default": "./dist/cjs/contributions.js"
|
|
56
|
+
},
|
|
57
|
+
"default": "./dist/esm/contributions.js"
|
|
47
58
|
}
|
|
48
59
|
},
|
|
49
60
|
"files": [
|
|
@@ -79,7 +90,7 @@
|
|
|
79
90
|
"prepublishOnly": "bun run clean && bun run build"
|
|
80
91
|
},
|
|
81
92
|
"dependencies": {
|
|
82
|
-
"@peable.to/shared-types": "0.
|
|
93
|
+
"@peable.to/shared-types": "0.4.0",
|
|
83
94
|
"qrcode-generator": "^2.0.4",
|
|
84
95
|
"socket.io-client": "^4.8.3",
|
|
85
96
|
"@peable.to/contracts": "0.1.0",
|