@smartpay/sdk-node
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -106,2 +106,5 @@ import type { CustomerInfo, CustomerInfoLoose, ProductData, PriceData, LineItemDataFlat, OrderDataLoose, ChekoutSessionPayloadFlat, ShippingInfo, Address, LooseObject } from './types'; | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
@@ -145,7 +148,8 @@ export declare const normalizeShipping: (shipping?: Partial<ShippingInfo> & Partial<Address>) => { | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
reference: string | undefined; | ||
metadata: import("./types").MetaData; | ||
successUrl: any; | ||
cancelUrl: any; | ||
successUrl: string; | ||
cancelUrl: string; | ||
}; | ||
@@ -184,9 +188,10 @@ declare const _default: { | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
reference: string | undefined; | ||
metadata: import("./types").MetaData; | ||
successUrl: any; | ||
cancelUrl: any; | ||
successUrl: string; | ||
cancelUrl: string; | ||
}; | ||
}; | ||
export default _default; |
@@ -191,2 +191,5 @@ declare const _default: { | ||
}; | ||
reference: { | ||
type: string; | ||
}; | ||
}; | ||
@@ -193,0 +196,0 @@ optionalProperties: { |
@@ -118,5 +118,6 @@ export interface LooseObject { | ||
coupons?: string[]; | ||
description?: string; | ||
lineItemData: LineItemData[]; | ||
shippingInfo?: ShippingInfo; | ||
reference?: string; | ||
description?: string; | ||
metadata?: MetaData; | ||
@@ -130,6 +131,7 @@ }; | ||
coupons?: string[]; | ||
description?: string; | ||
lineItemData?: LineItemData[]; | ||
items?: LineItemDataFlat[]; | ||
shippingInfo?: ShippingInfo; | ||
reference?: string; | ||
description?: string; | ||
metadata?: MetaData; | ||
@@ -158,4 +160,6 @@ }; | ||
reference?: string; | ||
successUrl: string; | ||
cancelUrl: string; | ||
successURL?: string; | ||
cancelURL?: string; | ||
successUrl?: string; | ||
cancelUrl?: string; | ||
description?: string; | ||
@@ -162,0 +166,0 @@ metadata?: MetaData; |
@@ -54,7 +54,8 @@ import type { KeyString, ChekoutSessionPayload, ChekoutSessionPayloadFlat, ErrorDetails } from './types'; | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
reference: string | undefined; | ||
metadata: import("./types").MetaData; | ||
successUrl: any; | ||
cancelUrl: any; | ||
successUrl: string; | ||
cancelUrl: string; | ||
}; | ||
@@ -61,0 +62,0 @@ export declare const DEFAULT_ERROR_MESSAGES: { |
@@ -207,3 +207,6 @@ var __defProp = Object.defineProperty; | ||
items, | ||
lineItemData | ||
lineItemData, | ||
reference, | ||
description, | ||
metadata | ||
} = order; | ||
@@ -218,3 +221,6 @@ const rest = omit(order, [ | ||
"items", | ||
"lineItemData" | ||
"lineItemData", | ||
"reference", | ||
"description", | ||
"metadata" | ||
]); | ||
@@ -228,3 +234,6 @@ return __spreadProps(__spreadValues({}, rest), { | ||
shippingInfo, | ||
lineItemData: normalizeLineItemDataList(lineItemData || items) | ||
lineItemData: normalizeLineItemDataList(lineItemData || items), | ||
reference, | ||
description, | ||
metadata | ||
}); | ||
@@ -298,6 +307,4 @@ }; | ||
reference, | ||
description, | ||
metadata, | ||
orderDescription, | ||
orderMetadata, | ||
promotionCode, | ||
successUrl, | ||
@@ -323,4 +330,3 @@ cancelUrl, | ||
"metadata", | ||
"orderDescription", | ||
"orderMetadata", | ||
"description", | ||
"promotionCode", | ||
@@ -330,6 +336,2 @@ "successUrl", | ||
]); | ||
const parsedMetadata = metadata || {}; | ||
if (promotionCode) { | ||
parsedMetadata.__promotion_code__ = promotionCode; | ||
} | ||
return __spreadProps(__spreadValues({}, rest), { | ||
@@ -346,9 +348,8 @@ customerInfo: normalizeCustomerInfo(customerInfo || customer), | ||
lineItemData, | ||
description: orderDescription, | ||
metadata: orderMetadata | ||
reference, | ||
description, | ||
metadata | ||
}), | ||
reference, | ||
metadata: parsedMetadata, | ||
successUrl: successUrl || successURL, | ||
cancelUrl: cancelUrl || cancelURL | ||
successUrl: successUrl || successURL || "", | ||
cancelUrl: cancelUrl || cancelURL || "" | ||
}); | ||
@@ -443,3 +444,4 @@ }; | ||
additionalProperties: true | ||
} | ||
}, | ||
reference: { type: "string" } | ||
}, | ||
@@ -669,3 +671,3 @@ optionalProperties: { | ||
"dev-lang": "nodejs", | ||
"sdk-version": "0.2.0" | ||
"sdk-version": "0.3.0" | ||
}; | ||
@@ -703,3 +705,2 @@ const req = this.request(`/checkout-sessions?${qs.stringify(params)}`, { | ||
getSessionURL(session, options) { | ||
var _a2; | ||
if (!session) { | ||
@@ -717,11 +718,8 @@ throw new SmartError({ | ||
} | ||
const checkoutURL = (options == null ? void 0 : options.checkoutURL) || this._checkoutURL; | ||
const params = { | ||
"session-id": session.id, | ||
"public-key": this._publicKey | ||
"public-key": this._publicKey, | ||
"promotion-code": options == null ? void 0 : options.promotionCode | ||
}; | ||
const promotionCode = (options == null ? void 0 : options.promotionCode) || ((_a2 = session.metadata) == null ? void 0 : _a2.__promotion_code__); | ||
if (promotionCode) { | ||
params["promotion-code"] = promotionCode; | ||
} | ||
const checkoutURL = (options == null ? void 0 : options.checkoutURL) || this._checkoutURL; | ||
return qs.stringifyUrl({ | ||
@@ -728,0 +726,0 @@ url: `${checkoutURL}/login`, |
@@ -106,2 +106,5 @@ import type { CustomerInfo, CustomerInfoLoose, ProductData, PriceData, LineItemDataFlat, OrderDataLoose, ChekoutSessionPayloadFlat, ShippingInfo, Address, LooseObject } from './types'; | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
@@ -145,7 +148,8 @@ export declare const normalizeShipping: (shipping?: Partial<ShippingInfo> & Partial<Address>) => { | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
reference: string | undefined; | ||
metadata: import("./types").MetaData; | ||
successUrl: any; | ||
cancelUrl: any; | ||
successUrl: string; | ||
cancelUrl: string; | ||
}; | ||
@@ -184,9 +188,10 @@ declare const _default: { | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
reference: string | undefined; | ||
metadata: import("./types").MetaData; | ||
successUrl: any; | ||
cancelUrl: any; | ||
successUrl: string; | ||
cancelUrl: string; | ||
}; | ||
}; | ||
export default _default; |
@@ -191,2 +191,5 @@ declare const _default: { | ||
}; | ||
reference: { | ||
type: string; | ||
}; | ||
}; | ||
@@ -193,0 +196,0 @@ optionalProperties: { |
@@ -118,5 +118,6 @@ export interface LooseObject { | ||
coupons?: string[]; | ||
description?: string; | ||
lineItemData: LineItemData[]; | ||
shippingInfo?: ShippingInfo; | ||
reference?: string; | ||
description?: string; | ||
metadata?: MetaData; | ||
@@ -130,6 +131,7 @@ }; | ||
coupons?: string[]; | ||
description?: string; | ||
lineItemData?: LineItemData[]; | ||
items?: LineItemDataFlat[]; | ||
shippingInfo?: ShippingInfo; | ||
reference?: string; | ||
description?: string; | ||
metadata?: MetaData; | ||
@@ -158,4 +160,6 @@ }; | ||
reference?: string; | ||
successUrl: string; | ||
cancelUrl: string; | ||
successURL?: string; | ||
cancelURL?: string; | ||
successUrl?: string; | ||
cancelUrl?: string; | ||
description?: string; | ||
@@ -162,0 +166,0 @@ metadata?: MetaData; |
@@ -54,7 +54,8 @@ import type { KeyString, ChekoutSessionPayload, ChekoutSessionPayloadFlat, ErrorDetails } from './types'; | ||
}[]; | ||
reference: string | undefined; | ||
description: string | undefined; | ||
metadata: import("./types").MetaData | undefined; | ||
}; | ||
reference: string | undefined; | ||
metadata: import("./types").MetaData; | ||
successUrl: any; | ||
cancelUrl: any; | ||
successUrl: string; | ||
cancelUrl: string; | ||
}; | ||
@@ -61,0 +62,0 @@ export declare const DEFAULT_ERROR_MESSAGES: { |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Smartpay SDK NodeJS", | ||
@@ -10,0 +10,0 @@ "main": "./build/cjs/index.cjs", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103005
3283