Skip to content

Fix application fee amount handling #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

athlonUA
Copy link
Contributor

@athlonUA athlonUA commented May 7, 2025

Summary

This PR ensures that the application_fee_amount value from Stripe's PaymentIntent always defaults to 0 if it is not set. This prevents potential issues with null values and guarantees consistent handling of application fees throughout the payment processing workflow.

Details

  • Used the null coalescing operator (?? 0) when accessing $paymentIntent->application_fee_amount in all relevant places.
  • This ensures that if Stripe does not provide an application_fee_amount, the system will safely use 0 as the default.
  • Improves reliability and prevents errors related to missing or null fee amounts.

Motivation

This change improves the robustness of the payment handling logic by ensuring that all calculations and records involving the application fee are based on a valid integer value, even if Stripe omits the field.

Checklist

  • Code follows project standards
  • All usages of application_fee_amount are safely defaulted to 0
  • Tested to ensure no errors occur when the field is missing

Set default to 0 if not set
Copy link
Contributor

github-actions bot commented May 7, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@athlonUA
Copy link
Contributor Author

athlonUA commented May 7, 2025

recheck

@daveearley daveearley requested a review from Copilot May 8, 2025 02:16
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that the application fee amount from Stripe's PaymentIntent is always set to a valid integer (0) when not provided, thereby preventing potential null-related errors in fee processing.

  • Default the fee amount value to 0 using the null coalescing operator (?? 0).
  • Improve the robustness of the payment processing workflow by eliminating null value issues.

@daveearley
Copy link
Contributor

Thanks for this!

@daveearley daveearley merged commit 79d04b1 into HiEventsDev:develop May 13, 2025
3 of 4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants