Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/core/src/bodl/bodl-emitter-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export default class BodlEmitterService implements BodlService {
checkoutBegin(): void {
const data = this._getCommonCheckoutData();

console.log("LOG IS CAPTURED BELOW!!! ")
console.log(data)

if (this._checkoutStarted || !data) {
return;
}
Expand Down Expand Up @@ -202,6 +205,8 @@ export default class BodlEmitterService implements BodlService {
channelId,
} = checkout;

console.log("Line items", lineItems)

return {
event_id: id,
currency: currency.code,
Expand All @@ -216,7 +221,7 @@ export default class BodlEmitterService implements BodlService {
const customItems: BODLProduct[] = (lineItems.customItems || []).map((item) => ({
product_id: item.id,
sku: item.sku,
base_price: item.listPrice,
base_price: item.originalPrice,
sale_price: item.listPrice,
purchase_price: item.listPrice,
quantity: item.quantity,
Expand Down Expand Up @@ -260,11 +265,14 @@ export default class BodlEmitterService implements BodlService {
itemAttributes.sort();
}

console.log("THE ITEM ", item)
console.log("THE BASE/ORIGIN PRICE IS")
console.log(item.originalPrice)
return {
product_id: item.productId,
quantity: item.quantity,
product_name: item.name,
base_price: item.listPrice,
base_price: item.originalPrice,
sale_price: item.salePrice,
purchase_price: item.salePrice > 0 ? item.salePrice : item.listPrice,
sku: item.sku,
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/bodl/bodl-events-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('BodlEmitterService', () => {
product_id: '103',
sku: 'CLC',
product_name: 'Canvas Laundry Cart',
base_price: 200,
base_price: 250,
sale_price: 190,
retail_price: 210,
purchase_price: 190,
Expand All @@ -125,7 +125,7 @@ describe('BodlEmitterService', () => {
product_id: '104',
sku: 'CLX',
product_name: 'Digital Book',
base_price: 200,
base_price: 250,
purchase_price: 200,
sale_price: 200,
retail_price: 210,
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('BodlEmitterService', () => {
product_id: '103',
sku: 'CLC',
product_name: 'Canvas Laundry Cart',
base_price: 200,
base_price: 250,
sale_price: 190,
purchase_price: 190,
retail_price: 210,
Expand Down Expand Up @@ -339,7 +339,7 @@ describe('BodlEmitterService', () => {
product_id: '103',
sku: 'CLC',
product_name: 'Canvas Laundry Cart',
base_price: 200,
base_price: 250,
sale_price: 190,
purchase_price: 190,
quantity: 1,
Expand All @@ -355,7 +355,7 @@ describe('BodlEmitterService', () => {
product_id: '104',
sku: 'CLX',
product_name: 'Digital Book',
base_price: 200,
base_price: 250,
purchase_price: 200,
sale_price: 200,
quantity: 1,
Expand Down Expand Up @@ -522,7 +522,7 @@ describe('BodlEmitterService', () => {
product_id: '103',
sku: 'CLC',
product_name: 'Canvas Laundry Cart',
base_price: 200,
base_price: 250,
sale_price: 190,
purchase_price: 190,
quantity: 1,
Expand All @@ -538,7 +538,7 @@ describe('BodlEmitterService', () => {
product_id: '104',
sku: 'CLX',
product_name: 'Digital Book',
base_price: 200,
base_price: 250,
purchase_price: 200,
sale_price: 200,
quantity: 1,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/cart/line-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface CustomItem {
id: string;
listPrice: number;
extendedListPrice: number;
originalPrice: number
name: string;
quantity: number;
sku: string;
Expand Down Expand Up @@ -56,6 +57,7 @@ export interface LineItem {
discountAmount: number;
couponAmount: number;
listPrice: number;
originalPrice: number
salePrice: number;
retailPrice: number;
comparisonPrice: number;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/cart/line-items.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function getPhysicalItem(): PhysicalItem {
discountAmount: 10,
couponAmount: 5,
listPrice: 200,
originalPrice: 250,
salePrice: 190,
retailPrice: 210,
comparisonPrice: 200,
Expand Down Expand Up @@ -53,6 +54,7 @@ export function getDigitalItem(): DigitalItem {
discountAmount: 0,
couponAmount: 5,
listPrice: 200,
originalPrice: 250,
salePrice: 200,
retailPrice: 210,
comparisonPrice: 200,
Expand Down
2 changes: 2 additions & 0 deletions packages/payment-integration-api/src/cart/line-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface DigitalItem extends LineItem {
export interface CustomItem {
id: string;
listPrice: number;
originalPrice: number
extendedListPrice: number;
name: string;
quantity: number;
Expand Down Expand Up @@ -56,6 +57,7 @@ export interface LineItem {
discountAmount: number;
couponAmount: number;
listPrice: number;
originalPrice: number
salePrice: number;
retailPrice: number;
comparisonPrice: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export function getCustomItem(): CustomItem {
return {
id: '55e11c8f-7dce-4da3-9413-b649533f8bad',
listPrice: 10,
originalPrice: 30,
extendedListPrice: 20,
name: 'Custom item',
quantity: 2,
Expand All @@ -27,6 +28,7 @@ export function getPhysicalItem(): PhysicalItem {
discountAmount: 10,
couponAmount: 0,
listPrice: 200,
originalPrice: 250,
salePrice: 190,
retailPrice: 210,
comparisonPrice: 200,
Expand Down Expand Up @@ -64,6 +66,7 @@ export function getDigitalItem(): DigitalItem {
discountAmount: 0,
couponAmount: 0,
listPrice: 200,
originalPrice: 250,
salePrice: 200,
retailPrice: 210,
comparisonPrice: 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function getCustomItem(): CustomItem {
id: '55e11c8f-7dce-4da3-9413-b649533f8bad',
listPrice: 10,
extendedListPrice: 20,
originalPrice: 25,
name: 'Custom item',
quantity: 2,
sku: 'custom-sku',
Expand All @@ -32,6 +33,7 @@ export function getPhysicalItem(): PhysicalItem {
discountAmount: 10,
couponAmount: 0,
listPrice: 200,
originalPrice: 250,
salePrice: 190,
retailPrice: 210,
comparisonPrice: 200,
Expand Down Expand Up @@ -69,6 +71,7 @@ export function getDigitalItem(): DigitalItem {
discountAmount: 0,
couponAmount: 0,
listPrice: 200,
originalPrice: 250,
salePrice: 200,
retailPrice: 210,
comparisonPrice: 200,
Expand Down