@smartpay/sdk-node
Advanced tools
Comparing version 0.7.0 to 0.8.0
import type { CustomerInfo, CustomerInfoLoose, SimpleLineItem, SimpleChekoutSessionPayload, ShippingInfo, Address } from './types'; | ||
export declare const normalizeCustomerInfo: (customer?: CustomerInfoLoose) => CustomerInfo; | ||
export declare const normalizeItem: (item: SimpleLineItem) => { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -23,4 +24,5 @@ categories: string[] | undefined; | ||
export declare const normalizeItems: (list?: SimpleLineItem[]) => { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -76,4 +78,5 @@ categories: string[] | undefined; | ||
items: { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -126,4 +129,5 @@ categories: string[] | undefined; | ||
items: { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -130,0 +134,0 @@ categories: string[] | undefined; |
@@ -82,3 +82,6 @@ declare const _default: { | ||
lineItem: { | ||
properties: { | ||
optionalProperties: { | ||
kind: { | ||
type: string; | ||
}; | ||
name: { | ||
@@ -96,4 +99,2 @@ type: string; | ||
}; | ||
}; | ||
optionalProperties: { | ||
description: { | ||
@@ -100,0 +101,0 @@ type: string; |
@@ -76,2 +76,3 @@ export interface LooseObject { | ||
export declare type LineItemData = { | ||
kind?: string; | ||
price?: string; | ||
@@ -85,4 +86,5 @@ priceData?: PriceData; | ||
export declare type SimpleLineItem = { | ||
quantity: number; | ||
name: string; | ||
kind?: string; | ||
quantity?: number; | ||
name?: string; | ||
brand?: string; | ||
@@ -89,0 +91,0 @@ categories?: string[]; |
@@ -32,4 +32,5 @@ import type { KeyString, SimpleChekoutSessionPayload, ErrorDetails, LooseObject } from './types'; | ||
items: { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -36,0 +37,0 @@ categories: string[] | undefined; |
@@ -74,2 +74,3 @@ var __defProp = Object.defineProperty; | ||
const { | ||
kind, | ||
quantity, | ||
@@ -94,2 +95,3 @@ name, | ||
const rest = omit(item, [ | ||
"kind", | ||
"quantity", | ||
@@ -114,2 +116,3 @@ "name", | ||
return __spreadProps(__spreadValues({}, rest), { | ||
kind, | ||
quantity, | ||
@@ -271,9 +274,8 @@ name, | ||
lineItem: { | ||
properties: { | ||
optionalProperties: { | ||
kind: { type: "string" }, | ||
name: { type: "string" }, | ||
quantity: { type: "uint16" }, | ||
amount: { type: "uint32" }, | ||
currency: { type: "string" } | ||
}, | ||
optionalProperties: { | ||
currency: { type: "string" }, | ||
description: { type: "string" }, | ||
@@ -414,3 +416,3 @@ priceDescription: { type: "string" }, | ||
if (itemCurrency === currency) { | ||
return sum + (item.amount ? item.amount * item.quantity : 0); | ||
return sum + (item.kind === "discount" ? -1 : 1) * (item.amount ? item.amount * (item.quantity || 1) : 0); | ||
} | ||
@@ -478,3 +480,3 @@ throw new SmartpayError({ | ||
"dev-lang": "nodejs", | ||
"sdk-version": "0.7.0" | ||
"sdk-version": "0.8.0" | ||
}) | ||
@@ -481,0 +483,0 @@ }); |
import type { CustomerInfo, CustomerInfoLoose, SimpleLineItem, SimpleChekoutSessionPayload, ShippingInfo, Address } from './types'; | ||
export declare const normalizeCustomerInfo: (customer?: CustomerInfoLoose) => CustomerInfo; | ||
export declare const normalizeItem: (item: SimpleLineItem) => { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -23,4 +24,5 @@ categories: string[] | undefined; | ||
export declare const normalizeItems: (list?: SimpleLineItem[]) => { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -76,4 +78,5 @@ categories: string[] | undefined; | ||
items: { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -126,4 +129,5 @@ categories: string[] | undefined; | ||
items: { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -130,0 +134,0 @@ categories: string[] | undefined; |
@@ -82,3 +82,6 @@ declare const _default: { | ||
lineItem: { | ||
properties: { | ||
optionalProperties: { | ||
kind: { | ||
type: string; | ||
}; | ||
name: { | ||
@@ -96,4 +99,2 @@ type: string; | ||
}; | ||
}; | ||
optionalProperties: { | ||
description: { | ||
@@ -100,0 +101,0 @@ type: string; |
@@ -76,2 +76,3 @@ export interface LooseObject { | ||
export declare type LineItemData = { | ||
kind?: string; | ||
price?: string; | ||
@@ -85,4 +86,5 @@ priceData?: PriceData; | ||
export declare type SimpleLineItem = { | ||
quantity: number; | ||
name: string; | ||
kind?: string; | ||
quantity?: number; | ||
name?: string; | ||
brand?: string; | ||
@@ -89,0 +91,0 @@ categories?: string[]; |
@@ -32,4 +32,5 @@ import type { KeyString, SimpleChekoutSessionPayload, ErrorDetails, LooseObject } from './types'; | ||
items: { | ||
quantity: number; | ||
name: string; | ||
kind: string | undefined; | ||
quantity: number | undefined; | ||
name: string | undefined; | ||
brand: string | undefined; | ||
@@ -36,0 +37,0 @@ categories: string[] | undefined; |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.7.0", | ||
"version": "0.8.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
225095
5507