Technical Design

This document defines how carnival will handle referral campaign effects and work on different events to support Referral Program

Generate Referral Code :

  • Nimbus will call Carnival with customer information to generate referral code.

  • Carnival will have all generated Referral Codes information in carnival.referral_codes table

  • If referral code for Customer already exists in database, Carnival will give that code to Nimbus. Otherwise it update customer session properties to trigger Campaign to generate referral code.

  • Carnival will update session with event : generate_referral_code_event and REFER_A_FRIEND Scenario

  • If talon.one gives "referralCreated" effect in response that means referral code is successfully created.

  • Carnival will persist referral code & customer information in carnival.referral_codes table

  • Customer will be known as Advocate of Referral Code.

Flow Diagram : Referral Code Generate

Validate Referral Code:

  • Nimbus will call Carnival with referral code information for validation

  • Carnival will update customer session with event validate_code_event , referral code and REFER_A_FRIEND Scenario

  • If talon.one gives "acceptReferral" effect in response that means referral code is valid.

  • Close Customer Session

  • Return validation status in response to Nimbus

Flow Diagram : Referral Code Validation

Customer Registration:

  • Carnival will listen to customer_registered event and create a registration session in talon.one with coupon code present in request and REFER_A_FRIEND scenario

  • Session id for this process will be : country code : login : Registered . Example : ae:[email protected]:Registered

  • Session will remain open for this event.

  • Carnival will close registration session when profile_approved will be triggered

Flow Diagram : Customer Registration

Profile Approved :

  • On profile_approved event carnival will update registration session in talon.one

  • If any valid referral code exists in that registration session, Talon.one will trigger some effects

  • If all conditions defined in Campaign Rule set are satisfied , Talon.one will give redeemReferral , acceptReferral , setDiscount and couponCreated effect types

  • redeemReferral and acceptReferral tells that referral code has been successfully redeemed.

  • setDiscount effect type is to give credits to approved customer.

  • Carnival will call Vanguard to give credits to customer and add effect as APPLIED in effect_usages table

  • couponCreated effect type is for Advocate. Talon.One will give information about generated coupon code for Advocate

  • Carnival will update carnival.coupon_usages table with advocate coupon information.

  • Status for coupon will be AUTHORIZED, Advocate id will be null (Because it's not a referral coupon) and Friend id will be id of approved customer.

Flow Diagram : Profile Approved

Usage Started :

  • On usage_started_event event carnival will check for any existing authorized referral code in coupon_usages table with friend id as customer's login id

  • If authorized referral code exists for customer as friend , Carnival will update customer session with coupon code , REFER_A_FRIEND Scenario and advocate profile id.

  • Talon.one will give setDiscount effect type and coupon will be redeemed on Talon.one

  • Carnival will create effect for discount in effect_usages as applied for Advocate and call vanguard to give credits to advocate

  • It will also update coupon status to CAPTURED in coupon_usages table

Flow Diagram : Usage Started

Last updated

Was this helpful?