-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.ts
40 lines (34 loc) · 1.74 KB
/
sample.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { AdsCheckout } from "./src/ads-checkout";
import { DealPricingRule } from "./src/deal-pricing-rule";
import { DiscountPricingRule } from "./src/discount-pricing-rule";
import { PricingRule } from "./src/types";
const secondBitePricingRule: PricingRule = new DealPricingRule("SecondBite", "classic", 3, 2);
const axilCoffeePricingRule: PricingRule = new DiscountPricingRule("Axil Coffee Roasters", "stand_out", 299.99);
const myerStandOutPricingRule: PricingRule = new DealPricingRule("MYER", "stand_out", 5, 4)
const myerPremiumPricingRule: PricingRule = new DiscountPricingRule("MYER", "premium", 389.99);
const rules = [secondBitePricingRule, axilCoffeePricingRule, myerStandOutPricingRule, myerPremiumPricingRule];
const defaultAdsCheckout = AdsCheckout.new("default", rules);
defaultAdsCheckout.add("classic");
defaultAdsCheckout.add("stand_out");
defaultAdsCheckout.add("premium");
console.log(defaultAdsCheckout.total());
const secondBiteAdsCheckout = AdsCheckout.new("SecondBite", rules);
secondBiteAdsCheckout.add("classic");
secondBiteAdsCheckout.add("classic");
secondBiteAdsCheckout.add("classic");
secondBiteAdsCheckout.add("premium");
console.log(secondBiteAdsCheckout.total());
const axilCoffeeAdsCheckout = AdsCheckout.new("Axil Coffee Roasters", rules);
axilCoffeeAdsCheckout.add("stand_out");
axilCoffeeAdsCheckout.add("stand_out");
axilCoffeeAdsCheckout.add("stand_out");
axilCoffeeAdsCheckout.add("premium");
console.log(axilCoffeeAdsCheckout.total());
const myerAdsCheckout = AdsCheckout.new("MYER", rules);
myerAdsCheckout.add("stand_out");
myerAdsCheckout.add("stand_out");
myerAdsCheckout.add("stand_out");
myerAdsCheckout.add("stand_out");
myerAdsCheckout.add("stand_out");
myerAdsCheckout.add("premium");
console.log(myerAdsCheckout.total());