CouponInfo - itsManeka/amazing-scraper GitHub Wiki
amazing-scraper / CouponInfo
Defined in: src/domain/entities/CouponInfo.ts:10
Information extracted from a product page's coupon link.
promotionMerchantId is kept as a separate field from redirectMerchantId
because the POST payload uses both, and they may diverge across different coupons.
When isIndividual === true, the coupon is an inline "individual" coupon shown directly
on the product page (not a PSP coupon with its own /promotion/psp/ page). In this case,
the optional metadata fields (discountText, description, termsUrl) are populated.
couponCode:
string|null
Defined in: src/domain/entities/CouponInfo.ts:20
Alphanumeric coupon code extracted from the product page text
(e.g. "FJOVKLWWIZXM" from "com o cupom FJOVKLWWIZXM").
null when no code is found in the surrounding text.
optionaldescription:string|null
Defined in: src/domain/entities/CouponInfo.ts:37
Human-readable message shown in the inline block (normalised text),
without the leading "off." prefix.
Present only when isIndividual === true. null when message is empty.
optionaldiscountPercent:number|null
Defined in: src/domain/entities/CouponInfo.ts:54
Discount percentage extracted from "Aplicar cupom de X%" pattern.
Present only when isApplicable === true. null when parsing fails.
optionaldiscountText:string|null
Defined in: src/domain/entities/CouponInfo.ts:31
Discount text extracted from the badge element (e.g. "R$20", "20%").
Present only when isIndividual === true. null when badge is not found.
optionalisApplicable:boolean
Defined in: src/domain/entities/CouponInfo.ts:49
Discriminant: set to true when this coupon is an "applicable" coupon
(pattern "Aplicar cupom de X%" without specific coupon code).
Present only when the coupon is both individual and applicable.
optionalisIndividual:true
Defined in: src/domain/entities/CouponInfo.ts:26
Discriminant: set to true when this coupon is an "individual" coupon
(inline promotion shown directly on the product page, not a PSP coupon).
undefined when this is a PSP-style coupon.
optionalparticipatingProductsUrl:string|null
Defined in: src/domain/entities/CouponInfo.ts:59
URL of the participating products page for applicable coupons.
Present only when isApplicable === true. null when not found or not applicable.
promotionId:
string
Defined in: src/domain/entities/CouponInfo.ts:11
promotionMerchantId:
string
Defined in: src/domain/entities/CouponInfo.ts:14
redirectAsin:
string
Defined in: src/domain/entities/CouponInfo.ts:12
redirectMerchantId:
string
Defined in: src/domain/entities/CouponInfo.ts:13
optionaltermsUrl:string|null
Defined in: src/domain/entities/CouponInfo.ts:43
Relative URL of the popover endpoint that serves the coupon terms
(e.g. "/promotion/details/popup/ATVO4IBO0PTIE?ref=cxcw_bxgx_tc_...").
Present only when isIndividual === true. null when the modal attribute is absent.