@lunora/payment 1.0.0-alpha.16 → 1.0.0-alpha.17
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/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createAdapterRegistry } from './packem_shared/createAdapterRegistry-Ds7bx_TK.mjs';
|
|
2
|
-
export { lunoraDatabaseToPaymentDatabase, paymentsFromContext } from './packem_shared/lunoraDatabaseToPaymentDatabase-
|
|
3
|
-
export { createPayment } from './packem_shared/createPayment-
|
|
2
|
+
export { lunoraDatabaseToPaymentDatabase, paymentsFromContext } from './packem_shared/lunoraDatabaseToPaymentDatabase-CtPF9eaA.mjs';
|
|
3
|
+
export { createPayment } from './packem_shared/createPayment-DOvclCGs.mjs';
|
|
4
4
|
export { createDatabasePaymentStore } from './packem_shared/createDatabasePaymentStore-C0NUCj1H.mjs';
|
|
5
5
|
export { entitlementsForReference, featureNames, hasActivePrice, resolveEntitlements, usagePeriodStart } from './packem_shared/entitlementsForReference-CzZGXPoZ.mjs';
|
|
6
6
|
export { LunoraPaymentError } from './packem_shared/LunoraPaymentError-BeQlhkZj.mjs';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { toErrorBody } from '@lunora/errors';
|
|
1
2
|
import { usagePeriodStart, resolveEntitlements, featureNames, hasActivePrice } from './entitlementsForReference-CzZGXPoZ.mjs';
|
|
2
3
|
import { LunoraPaymentError } from './LunoraPaymentError-BeQlhkZj.mjs';
|
|
3
4
|
import idempotencyKey from './idempotencyKey-BFzDCA7g.mjs';
|
|
4
5
|
import { n as notifyObserver } from './observability-CvhJ205g.mjs';
|
|
5
6
|
import applyWebhookAction from './applyWebhookAction-CLAx4svt.mjs';
|
|
6
7
|
|
|
7
|
-
const jsonResponse = (body, status) => Response.json(body, { headers: { "content-type": "application/json" }, status });
|
|
8
|
+
const jsonResponse = (body, status = 200, headers) => Response.json(body, { headers: { "content-type": "application/json", ...headers }, status });
|
|
9
|
+
|
|
8
10
|
const stripReferenceId = (metadata) => metadata && "referenceId" in metadata ? Object.fromEntries(Object.entries(metadata).filter(([key]) => key !== "referenceId")) : metadata;
|
|
9
11
|
const createPayment = (options) => {
|
|
10
12
|
const { adapter, store } = options;
|
|
@@ -107,7 +109,8 @@ const createPayment = (options) => {
|
|
|
107
109
|
action = await adapter.parseWebhook({ headers: request.headers, payload });
|
|
108
110
|
} catch (error) {
|
|
109
111
|
if (error instanceof LunoraPaymentError) {
|
|
110
|
-
|
|
112
|
+
const { body, status } = toErrorBody(error);
|
|
113
|
+
return jsonResponse({ error: body.message }, status);
|
|
111
114
|
}
|
|
112
115
|
return jsonResponse({ error: "webhook error" }, 400);
|
|
113
116
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPayment } from './createPayment-
|
|
1
|
+
import { createPayment } from './createPayment-DOvclCGs.mjs';
|
|
2
2
|
import { createDatabasePaymentStore } from './createDatabasePaymentStore-C0NUCj1H.mjs';
|
|
3
3
|
|
|
4
4
|
const lunoraDatabaseToPaymentDatabase = (database) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/payment",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"description": "Provider-agnostic payments for Lunora: Stripe-first adapter, webhook sync, and subscription/payment state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"billing",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
51
|
-
"@lunora/server": "1.0.0-alpha.
|
|
52
|
-
"@lunora/values": "1.0.0-alpha.
|
|
50
|
+
"@lunora/errors": "1.0.0-alpha.2",
|
|
51
|
+
"@lunora/server": "1.0.0-alpha.17",
|
|
52
|
+
"@lunora/values": "1.0.0-alpha.5",
|
|
53
53
|
"dinero.js": "2.0.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"stripe": "^19.0.0"
|
|
56
|
+
"stripe": "^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"stripe": {
|