@alphawebai/hs-prism 0.1.0-rc.49 → 0.1.0-rc.50
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/src/alphaweb/manifest.d.ts +1 -1
- package/dist/src/alphaweb/manifest.js +1 -1
- package/dist/src/alphaweb/paypal-connector.js +46 -0
- package/dist/src/alphaweb/types.d.ts +12 -0
- package/dist/src/payments/generated/libconnector_service_ffi.so +2 -2
- package/dist/src/payments/generated/proto.d.ts +6 -0
- package/dist/src/payments/generated/proto.js +29 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const ALPHAWEB_STRIPE_WEBHOOK_EVENTS: readonly ["charge.dispute.closed", "charge.dispute.created", "charge.dispute.funds_reinstated", "charge.dispute.funds_withdrawn", "charge.dispute.updated", "mandate.updated", "payment_intent.amount_capturable_updated", "payment_intent.canceled", "payment_intent.payment_failed", "payment_intent.processing", "payment_intent.requires_action", "payment_intent.succeeded", "payment_method.attached", "payment_method.automatically_updated", "payment_method.detached", "payment_method.updated", "refund.created", "refund.failed", "refund.updated", "setup_intent.canceled", "setup_intent.requires_action", "setup_intent.setup_failed", "setup_intent.succeeded"];
|
|
2
2
|
export declare const ALPHAWEB_PAYPAL_WEBHOOK_EVENTS: readonly ["CHECKOUT.ORDER.APPROVED", "CHECKOUT.ORDER.COMPLETED", "CHECKOUT.ORDER.PROCESSED", "CHECKOUT.PAYMENT-APPROVAL.REVERSED", "CUSTOMER.DISPUTE.CREATED", "CUSTOMER.DISPUTE.RESOLVED", "CUSTOMER.DISPUTE.UPDATED", "PAYMENT.AUTHORIZATION.CREATED", "PAYMENT.AUTHORIZATION.VOIDED", "PAYMENT.CAPTURE.COMPLETED", "PAYMENT.CAPTURE.DECLINED", "PAYMENT.CAPTURE.PENDING", "PAYMENT.CAPTURE.REFUNDED", "PAYMENT.CAPTURE.REVERSED", "PAYMENT.REFUND.FAILED", "PAYMENT.REFUND.PENDING", "RISK.DISPUTE.CREATED", "VAULT.PAYMENT-TOKEN.CREATED", "VAULT.PAYMENT-TOKEN.DELETED", "VAULT.PAYMENT-TOKEN.DELETION-INITIATED"];
|
|
3
3
|
export declare const ALPHAWEB_PRISM_COMPATIBILITY_MANIFEST: Readonly<{
|
|
4
|
-
readonly release: "0.1.0-rc.
|
|
4
|
+
readonly release: "0.1.0-rc.50";
|
|
5
5
|
readonly upstreamCommit: "b07af7d9dac271de729548e74217ddcf895c602b";
|
|
6
6
|
readonly medusaRange: ">=2.17.2 <2.18.0";
|
|
7
7
|
readonly stripeApiVersion: "2026-06-24.dahlia";
|
|
@@ -49,7 +49,7 @@ exports.ALPHAWEB_PAYPAL_WEBHOOK_EVENTS = Object.freeze([
|
|
|
49
49
|
'VAULT.PAYMENT-TOKEN.DELETION-INITIATED',
|
|
50
50
|
]);
|
|
51
51
|
exports.ALPHAWEB_PRISM_COMPATIBILITY_MANIFEST = Object.freeze({
|
|
52
|
-
release: '0.1.0-rc.
|
|
52
|
+
release: '0.1.0-rc.50',
|
|
53
53
|
upstreamCommit: 'b07af7d9dac271de729548e74217ddcf895c602b',
|
|
54
54
|
medusaRange: '>=2.17.2 <2.18.0',
|
|
55
55
|
stripeApiVersion: '2026-06-24.dahlia',
|
|
@@ -5,6 +5,7 @@ exports.verifyPrismPayPalRuntimeCredential = verifyPrismPayPalRuntimeCredential;
|
|
|
5
5
|
const node_crypto_1 = require("node:crypto");
|
|
6
6
|
const _generated_connector_client_flows_1 = require("../payments/_generated_connector_client_flows");
|
|
7
7
|
const proto_1 = require("../payments/generated/proto");
|
|
8
|
+
const errors_1 = require("../payments/errors");
|
|
8
9
|
const error_1 = require("./error");
|
|
9
10
|
const manifest_1 = require("./manifest");
|
|
10
11
|
const money_1 = require("./money");
|
|
@@ -27,6 +28,29 @@ function readSecret(value) {
|
|
|
27
28
|
function secret(value) {
|
|
28
29
|
return { value };
|
|
29
30
|
}
|
|
31
|
+
function shippingAddressMessage(input) {
|
|
32
|
+
if (input.shippingAddress === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
const address = recordOf(input.shippingAddress);
|
|
35
|
+
const country = typeof address.countryCode === 'string' ? address.countryCode.trim().toUpperCase() : '';
|
|
36
|
+
const countryCode = proto_1.types.CountryAlpha2[country];
|
|
37
|
+
if (!/^[A-Z]{2}$/.test(country) || typeof countryCode !== 'number' ||
|
|
38
|
+
typeof address.line1 !== 'string' || !address.line1.trim()) {
|
|
39
|
+
throw validationError('The delivery address is incomplete.', 'PRISM_SHIPPING_ADDRESS');
|
|
40
|
+
}
|
|
41
|
+
const fields = ['firstName', 'lastName', 'line1', 'line2', 'city', 'state', 'postalCode'];
|
|
42
|
+
const shippingAddress = { countryAlpha2Code: countryCode };
|
|
43
|
+
for (const field of fields) {
|
|
44
|
+
const value = address[field];
|
|
45
|
+
if (value === undefined || value === '')
|
|
46
|
+
continue;
|
|
47
|
+
if (typeof value !== 'string') {
|
|
48
|
+
throw validationError('The delivery address is invalid.', 'PRISM_SHIPPING_ADDRESS');
|
|
49
|
+
}
|
|
50
|
+
shippingAddress[field === 'postalCode' ? 'zipCode' : field] = secret(value.trim());
|
|
51
|
+
}
|
|
52
|
+
return { shippingAddress };
|
|
53
|
+
}
|
|
30
54
|
function configurationError(safeMessage, code) {
|
|
31
55
|
return new error_1.PrismOperationError({
|
|
32
56
|
category: 'configuration',
|
|
@@ -939,6 +963,7 @@ class PrismPayPalConnector {
|
|
|
939
963
|
const setupFutureUsage = futureUseRequested(input);
|
|
940
964
|
const recurringAgreement = recurringAgreementMessage(input);
|
|
941
965
|
const continuation = browserContinuation(input);
|
|
966
|
+
const address = shippingAddressMessage(input);
|
|
942
967
|
const state = await this.connectorState();
|
|
943
968
|
const captureMethod = input.metadata.alphaweb_capture_method === 'manual'
|
|
944
969
|
? proto_1.types.CaptureMethod.MANUAL
|
|
@@ -959,6 +984,7 @@ class PrismPayPalConnector {
|
|
|
959
984
|
: proto_1.types.MitCategory.MIT_CATEGORY_UNSPECIFIED,
|
|
960
985
|
...(recurringAgreement ? { recurringAgreement } : {}),
|
|
961
986
|
...(continuation ?? {}),
|
|
987
|
+
...(address ? { address } : {}),
|
|
962
988
|
});
|
|
963
989
|
const orderId = stringOf(order.connectorOrderId);
|
|
964
990
|
if (!orderId) {
|
|
@@ -980,6 +1006,24 @@ class PrismPayPalConnector {
|
|
|
980
1006
|
};
|
|
981
1007
|
}
|
|
982
1008
|
catch (error) {
|
|
1009
|
+
const details = error instanceof errors_1.ConnectorError
|
|
1010
|
+
? error.proto.errorInfo?.connectorDetails ?? error.proto.error_info?.connector_details
|
|
1011
|
+
: undefined;
|
|
1012
|
+
const providerCode = details?.code;
|
|
1013
|
+
const shippingRejected = ['SHIPPING_ADDRESS_INVALID', 'CITY_REQUIRED', 'POSTAL_CODE_REQUIRED']
|
|
1014
|
+
.includes(providerCode ?? '');
|
|
1015
|
+
// Only these explicit Orders v2 creation rejections prove no order was
|
|
1016
|
+
// created. Never apply this classification to approval/capture or timeouts.
|
|
1017
|
+
if (error instanceof errors_1.ConnectorError && error.httpStatusCode === 422 &&
|
|
1018
|
+
error.errorCode === 'CONNECTOR_ERROR_RESPONSE' &&
|
|
1019
|
+
(providerCode === 'CURRENCY_NOT_SUPPORTED' || shippingRejected)) {
|
|
1020
|
+
throw new error_1.PrismOperationError({ category: 'validation', providerCode,
|
|
1021
|
+
retryable: false, outcome: 'definitely_not_applied',
|
|
1022
|
+
safeMessage: shippingRejected
|
|
1023
|
+
? 'Please check your delivery address, then try PayPal again.'
|
|
1024
|
+
: 'PayPal is unavailable for this currency. Please choose another payment method.',
|
|
1025
|
+
}, { cause: error });
|
|
1026
|
+
}
|
|
983
1027
|
throw (0, error_1.normalizePrismError)(error);
|
|
984
1028
|
}
|
|
985
1029
|
}
|
|
@@ -1050,6 +1094,7 @@ class PrismPayPalConnector {
|
|
|
1050
1094
|
throw validationError('PayPal reusable payment reference is incomplete.', 'PRISM_REFERENCE_NOT_READY');
|
|
1051
1095
|
}
|
|
1052
1096
|
try {
|
|
1097
|
+
const address = shippingAddressMessage(input);
|
|
1053
1098
|
const state = await this.connectorState();
|
|
1054
1099
|
const response = await this.dependencies.recurringPayments.charge({
|
|
1055
1100
|
merchantChargeId: input.idempotencyKey,
|
|
@@ -1070,6 +1115,7 @@ class PrismPayPalConnector {
|
|
|
1070
1115
|
paymentMethodType: proto_1.types.PaymentMethodType.PAY_PAL,
|
|
1071
1116
|
offSession: true,
|
|
1072
1117
|
mitCategory: repeatPaymentMitCategory(input),
|
|
1118
|
+
...(address ? { address } : {}),
|
|
1073
1119
|
state,
|
|
1074
1120
|
testMode: this.options.environment === 'test',
|
|
1075
1121
|
});
|
|
@@ -10,6 +10,17 @@ export interface PrismMoney {
|
|
|
10
10
|
amountMinor: string;
|
|
11
11
|
currency: string;
|
|
12
12
|
}
|
|
13
|
+
/** Merchant-collected delivery address, independent of the wallet's saved address. */
|
|
14
|
+
export interface PrismShippingAddress {
|
|
15
|
+
firstName?: string;
|
|
16
|
+
lastName?: string;
|
|
17
|
+
line1: string;
|
|
18
|
+
line2?: string;
|
|
19
|
+
city?: string;
|
|
20
|
+
state?: string;
|
|
21
|
+
postalCode?: string;
|
|
22
|
+
countryCode: string;
|
|
23
|
+
}
|
|
13
24
|
export type PrismReusableCapability = 'off_session' | 'post_purchase' | 'manual_capture' | 'subscription';
|
|
14
25
|
export type PrismFutureUsePurpose = 'post_purchase' | 'subscription';
|
|
15
26
|
export type PrismRecurringIntervalUnit = 'day' | 'week' | 'month' | 'year';
|
|
@@ -102,6 +113,7 @@ export interface PrismMerchantOperation {
|
|
|
102
113
|
kind: PrismOperationKind;
|
|
103
114
|
money: PrismMoney;
|
|
104
115
|
customerReference?: string;
|
|
116
|
+
shippingAddress?: PrismShippingAddress;
|
|
105
117
|
reusableReference?: PrismReusablePaymentReference;
|
|
106
118
|
futureUse?: PrismFutureUseIntent;
|
|
107
119
|
browserContinuation?: PrismBrowserContinuation;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/src/payments/generated/libconnector_service_ffi.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 105631296 bytes
|
|
4
|
+
sha256: db5dcad8916768dbd4a2e2c5949baeffdfc852421d73bbd5e1e572ac1d8d25ae
|
|
@@ -15336,6 +15336,9 @@ export namespace types {
|
|
|
15336
15336
|
|
|
15337
15337
|
/** PaymentServiceCreateOrderRequest cancelUrl */
|
|
15338
15338
|
cancelUrl?: (string|null);
|
|
15339
|
+
|
|
15340
|
+
/** Merchant-collected delivery/billing details. Existing callers may omit it. */
|
|
15341
|
+
address?: (types.IPaymentAddress|null);
|
|
15339
15342
|
}
|
|
15340
15343
|
|
|
15341
15344
|
/** Request message for creating an order */
|
|
@@ -15405,6 +15408,9 @@ export namespace types {
|
|
|
15405
15408
|
/** PaymentServiceCreateOrderRequest cancelUrl. */
|
|
15406
15409
|
public cancelUrl?: (string|null);
|
|
15407
15410
|
|
|
15411
|
+
/** Merchant-collected delivery/billing details. Existing callers may omit it. */
|
|
15412
|
+
public address?: (types.IPaymentAddress|null);
|
|
15413
|
+
|
|
15408
15414
|
/**
|
|
15409
15415
|
* Creates a new PaymentServiceCreateOrderRequest instance using the specified properties.
|
|
15410
15416
|
* @param [properties] Properties to set
|
|
@@ -48196,6 +48196,7 @@ $root.types = (function() {
|
|
|
48196
48196
|
* @property {string|null} [returnUrl] Provider-owned buyer continuation URLs for approval flows. Connectors that
|
|
48197
48197
|
* require future-use approval must fail closed when either URL is absent.
|
|
48198
48198
|
* @property {string|null} [cancelUrl] PaymentServiceCreateOrderRequest cancelUrl
|
|
48199
|
+
* @property {types.IPaymentAddress|null} [address] Merchant-collected delivery/billing details. Existing callers may omit it.
|
|
48199
48200
|
*/
|
|
48200
48201
|
|
|
48201
48202
|
/**
|
|
@@ -48331,6 +48332,14 @@ $root.types = (function() {
|
|
|
48331
48332
|
*/
|
|
48332
48333
|
PaymentServiceCreateOrderRequest.prototype.cancelUrl = null;
|
|
48333
48334
|
|
|
48335
|
+
/**
|
|
48336
|
+
* Merchant-collected delivery/billing details. Existing callers may omit it.
|
|
48337
|
+
* @member {types.IPaymentAddress|null|undefined} address
|
|
48338
|
+
* @memberof types.PaymentServiceCreateOrderRequest
|
|
48339
|
+
* @instance
|
|
48340
|
+
*/
|
|
48341
|
+
PaymentServiceCreateOrderRequest.prototype.address = null;
|
|
48342
|
+
|
|
48334
48343
|
// OneOf field names bound to virtual getters and setters
|
|
48335
48344
|
var $oneOfFields;
|
|
48336
48345
|
|
|
@@ -48412,6 +48421,12 @@ $root.types = (function() {
|
|
|
48412
48421
|
set: $util.oneOfSetter($oneOfFields)
|
|
48413
48422
|
});
|
|
48414
48423
|
|
|
48424
|
+
// Virtual OneOf for proto3 optional field
|
|
48425
|
+
Object.defineProperty(PaymentServiceCreateOrderRequest.prototype, "_address", {
|
|
48426
|
+
get: $util.oneOfGetter($oneOfFields = ["address"]),
|
|
48427
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
48428
|
+
});
|
|
48429
|
+
|
|
48415
48430
|
/**
|
|
48416
48431
|
* Creates a new PaymentServiceCreateOrderRequest instance using the specified properties.
|
|
48417
48432
|
* @function create
|
|
@@ -48468,6 +48483,8 @@ $root.types = (function() {
|
|
|
48468
48483
|
writer.uint32(/* id 13, wireType 2 =*/106).string(message.returnUrl);
|
|
48469
48484
|
if (message.cancelUrl != null && Object.hasOwnProperty.call(message, "cancelUrl"))
|
|
48470
48485
|
writer.uint32(/* id 14, wireType 2 =*/114).string(message.cancelUrl);
|
|
48486
|
+
if (message.address != null && Object.hasOwnProperty.call(message, "address"))
|
|
48487
|
+
$root.types.PaymentAddress.encode(message.address, writer.uint32(/* id 15, wireType 2 =*/122).fork(), q + 1).ldelim();
|
|
48471
48488
|
return writer;
|
|
48472
48489
|
};
|
|
48473
48490
|
|
|
@@ -48551,6 +48568,10 @@ $root.types = (function() {
|
|
|
48551
48568
|
message.cancelUrl = reader.string();
|
|
48552
48569
|
break;
|
|
48553
48570
|
}
|
|
48571
|
+
case 15: {
|
|
48572
|
+
message.address = $root.types.PaymentAddress.decode(reader, reader.uint32(), undefined, long + 1);
|
|
48573
|
+
break;
|
|
48574
|
+
}
|
|
48554
48575
|
default:
|
|
48555
48576
|
reader.skipType(tag & 7, long);
|
|
48556
48577
|
break;
|
|
@@ -48798,6 +48819,14 @@ $root.types = (function() {
|
|
|
48798
48819
|
if (!$util.isString(message.cancelUrl))
|
|
48799
48820
|
return "cancelUrl: string expected";
|
|
48800
48821
|
}
|
|
48822
|
+
if (message.address != null && Object.hasOwnProperty.call(message, "address")) {
|
|
48823
|
+
properties._address = 1;
|
|
48824
|
+
{
|
|
48825
|
+
var error = $root.types.PaymentAddress.verify(message.address, long + 1);
|
|
48826
|
+
if (error)
|
|
48827
|
+
return "address." + error;
|
|
48828
|
+
}
|
|
48829
|
+
}
|
|
48801
48830
|
return null;
|
|
48802
48831
|
};
|
|
48803
48832
|
|
package/package.json
CHANGED