facebook-nodejs-business-sdk icon indicating copy to clipboard operation
facebook-nodejs-business-sdk copied to clipboard

data_processing_options_country and data_processing_options_state are not sent when set to 0

Open thecodinglinguist opened this issue 4 years ago • 2 comments

Which SDK version are you using?

11

What's the issue?

The LDU flags data_processing_options_country and data_processing_options_state are not sent when their values are set to zero.

Steps/Sample code to reproduce the issue

.setDataProcessingOptions(['LDU']);
.setDataProcessingOptionsCountry(0);
.setDataProcessingOptionsState(0);

Observed Results:

FacebookRequestError: Invalid Values for Country and State Data Processing Options: The values you entered for data_processing_options_country and data_processing_options_state are invalid as a combination. Valid combinations are 0 and 0, or 1 and 1000.

Expected Results:

Both values should be sent when set to 0 as part of the payload.

Proposed solution.

Change the current truthy check in serverside/server-event.js to allow for a 0 value

Current

if (this.data_processing_options_country) {
    serverEvent.data_processing_options_country = this.data_processing_options_country;
}

if (this.data_processing_options_state) {
    serverEvent.data_processing_options_state = this.data_processing_options_state;
}

Proposed

if (this.data_processing_options_country || this.data_processing_options_country === 0) {
      serverEvent.data_processing_options_country = this.data_processing_options_country;
}

if (this.data_processing_options_state || this.data_processing_options_state === 0) {
      serverEvent.data_processing_options_state = this.data_processing_options_state;
}

thecodinglinguist avatar Aug 26 '21 08:08 thecodinglinguist

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 09 '22 02:01 stale[bot]

I have the same issue. It is still present in version 13 of the SDK, too.

lindsey-s avatar Apr 14 '22 19:04 lindsey-s

closed as #214 is merged.

stcheng avatar Jul 13 '23 17:07 stcheng