impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
340 stars 191 forks source link

Donation level id should store as string in database for donation form which generate in onboarding process #5940

Closed ravinderk closed 2 years ago

ravinderk commented 3 years ago

Details

I find out that donation level id stores in integer format for donation form which generated in onboarding. https://github.com/impress-org/givewp/blob/757e11895c8fd87cfa42d11d9eb8aa6ba1135a57/src/Onboarding/DefaultFormFactory.php#L150

Correct donation level id format is string. If we store donation level id as integer then, it is possible then at few place we will get wrong donation amount for that donation level ( if we are using strict type comparision ).

Expected Behavior

Donation level id must store in integer format.

Steps to Reproduce

  1. Complete GiveWP plugin onboarding process.
  2. Check _give_donation_levels meta key for donation form.

Visuals

Expected image

Result image

Acceptance Criteria

canny[bot] commented 3 years ago

This issue has been linked to a Canny post: Upsells should store the revenue correctly on forms created during the onboarding flow :tada:

JasonTheAdams commented 3 years ago

@ravinderk, why does it ultimately matter? Isn't the string ultimately being cast as an integer? Or the integer as a string? Why does this break things?

ravinderk commented 2 years ago

@ravinderk, why does it ultimately matter? Isn't the string ultimately being cast as an integer? Or the integer as a string? Why does this break things?

I discuss this with @JasonTheAdams in Slack and on the pull request.