UCP API calls needs rrid, which needs to be available as part of getLoggedInUser() response

Hello Team,

Delivery Fee extension requires the user id and rrid for connecting with UCP to get the Order Count details per cart type.

As of now, Delivery Fee extension uses the ApplicationClient.user.getLoggedInUser() API by passing the cookies request header values. We are able to get the user id and other details but not able to get the rrid, which is required by UCP API.

Usage Sample:

UserObjectSchema loggedInUser = appClientForUser.getUser().getLoggedInUser(requestHeaders);

Expected to get rrid from Meta object of com.sdk.application.user.UserApplicationModels$UserSchema.

Kindly extend your help to get this resolved at the earliest.

Hello @Pitchaimani

The response you get in this getLoggedInUser() method is based on what details you are locking in the deadlock. This method retrieves data from the service named "deadlock"; thus, the response is determined by the information stored within the deadlock service.

Therefore, please ensure that the RRID field is included when a user signs up for the first time. This data will be stored in deadlock and subsequently accessible in the output of getLoggedInUser() when calling the session API.

We use this method to store the details in deadlock

let res = await applicationClient.user.createUser({
                        body: obj,
                    });

To help you understand better, sharing one example:

We use this getLoggedInUser() function as a session API when users log in to the storefront. Sharing the response below:

{
  "status": 200,
  "data": {
    "user": {
      "_id": "659555bd4d06399365d7a829",
      "username": "jm786_605c6efd5ab8c845def75ae3",
      "emails": [
        {
          "email": "[email protected]",
          "active": true,
          "primary": true,
          "verified": true
        }
      ],
      "gender": "male",
      "active": true,
      "meta": {
        "sub": "7010881261",
        "mobile": "917010881261",
        "type": "COFO",
        "exp": 1706642048,
        "iat": 1706606048,
        "gstn": "",
        "pan": "",
        "email": null,
        "user_login": "JM786",
        "first_name": "Afroz",
        "last_name": "change)",
        "department_number": "R3",
        "prm_id": "JM786",
        "approved_at": null,
        "store_code": "JM9320",
        "tenant_name": "JMD",
        "tenant_id": "6486ce36515ae7145039f6a8"
      },
      "first_name": "Afroz",
      "last_name": "change)",
      "phone_numbers": [
        {
          "phone": "7010881261",
          "active": true,
          "primary": true,
          "verified": true,
          "country_code": 91
        }
      ],
      "account_type": "user",
      "profile_pic_url": "https://hdn-1.fynd.com/company/884/applications/000000000000000000000001/theme/pictures/free/original/default-profile_nxhzui.png",
      "user_id": "659555bd4d06399365d7a829",
      "application_id": "605c6efd5ab8c845def75ae3",
      "created_at": "2024-01-03T12:40:29.857Z",
      "updated_at": "2024-01-30T09:14:08.463Z"
    }
  }
}

Within this response, you will notice that we have included certain unique fields according to our requirements, such as PRMId, meta.user, etc.

Hello,

Thanks for your detailed response. I understood, how can we store custom fields into meta objects for the future reference.

In my case, i don’t control or customize the user signs up. Hence it wont be possible for me to do anything from the Extension. Hence this request was initiated to fill-in the RRID as part of UserSchema Meta Object and make it available as part of getLoggedInUser() response.

Please get in touch with @kedar2a , @Deepak_Basumatary to know more details about this REQUIREMENT and why and when extension needs this RRID value.