Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

POSSIBLE PROBLEM (these masses of data are prod)

frontend flow

When we applied the promo code on whitelabel, we receive an error: Something went wrong. Please try again.

request:

{
    "code": "8B9IKPQK",
    "cognitoId": "ec5cec01-b41b-509b-9111-310ab5a18154",
    "shouldRedeem": true,
    "offers": [
        "7bf2c11c-ec68-4d44-abd3-597b3967fcef"
    ]
}

response:

{
    "data": {
        "validatePromoCode": {
            "code": "8B9IKPQK",
            "reason": "misconfiguredCode",
            "message": "missing offerId",
            "isValid": false,
            "isRedeemed": false,
            "offerId": "",
            "__typename": "CBACouponResponse"
        }
    }
}

Attention points:

  • We always sending cognitoId attribute (cognitoId is like user id);

  • The promo code is CBACoupon type;

  • We sent a available offer "7bf2c11c-ec68-4d44-abd3-597b3967fcef";

backend flow

On backend, intl-promotion-service repository receive this call.

There is a method validateCoupon that receive the frontend call

  • path: intl-promotion-service/src/providers/vendors/voucherify.ts

This flow, is create a customers datas on voucherity with metadata:

{
    metadata: {
      userIdType: "cognitoId",
    },
    source_id: "ec5cec01-b41b-509b-9111-310ab5a18154",
  }
  • if userIdType: "cognitoId" so, the promo code is CBA type.

  • if userIdType: "loyaltyId" so, the promo code is loyalty type.

  • On frontend always send the attribute cognitoId on backend, in other words, the promo code at checkout will be always CBA type.

after that is validated the voucher with voucherify API client.validations.validateVoucher(), this return is:

{
  valid: true,
  applicable_to: { data: [], total: 0, data_ref: 'data', object: 'list' },
  inapplicable_to: { data: [], total: 0, data_ref: 'data', object: 'list' },
  tracking_id: 'track_ECpOaiQwipBVhSIEWGSfgmnjgtme+FQfW97lzOopYE6W1FvVYiEk7A==',
  code: 'INBIIT5F',
  discount: { type: 'AMOUNT', effect: 'APPLY_TO_ORDER', amount_off: 5000 },
  start_date: '2023-08-28T07:00:00.000Z',
  metadata: { configId: '7bf2c11c-ec68-4d44-abd3-597b3967fcef' },
  campaign: 'TEST VOUCHERIFY',
  campaign_id: 'camp_bHKpj7ruZxRPLoq2BqfCx0H2'
}

The problem start here, because the attribute metadata contains { configId: ‘7bf2c11c-ec68-4d44-abd3-597b3967fcef' }, this value is for loyalty code types, in other words, this return is worng, should be return an offerId attribute.

Solution:

 
 

Configuration Promo code

For show the feature on checkout:

After that:

To create the promotional codes, we need to access from Voucherify, this vendor is used current by PLK ES in production to create another promo codes on offers page;

  • No labels