Repository navigation
[Reimbursements] Fix the "Open on Wise" recipient link #15620
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
Open
kashsuks
wants to merge
9
commits into
hackclub:main
Choose a base branch
from
kashsuks:fix-wise-recipient-link
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+89
−31
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f286d64
feature[Wise]: Normalize recipient IDs on payout methods
kashsuks 3239b07
feature[Reimbursement]: Link the Wise button to the recipient page
kashsuks 34a8671
feature[Wise]: Backfill recipient IDs saved as URLs
kashsuks bd9cc3f
Merge branch 'main' into fix-wise-recipient-link
kashsuks 94c8c7c
Re-run CI
kashsuks 9597120
Merge branch 'fix-wise-recipient-link' of https://github.com/kashsuks…
kashsuks 50a8386
feature[Wise]: Accept pasted Wise transfer URLs with query strings
kashsuks e5044e6
feature[Wise]: Restore shortening Wise IDs on paste
kashsuks ee17478
feature[Wise]: Shorten Wise recipient IDs on paste
kashsuks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/tasks/maintenance/normalize_wise_recipient_ids_task.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Maintenance | ||
| # One-time cleanup: reimbursement approvals used to save the pasted Wise recipient URL | ||
| # (e.g. https://wise.com/recipients/<uuid>?new=undefined) onto the payout method as-is, | ||
| # which broke the "Open <name> on Wise" button. Reduces every stored value to the bare | ||
| # UUID, matching what `HasWiseRecipient#normalize_wise_recipient_id` does now. | ||
| # Run once after deploying. | ||
| class NormalizeWiseRecipientIdsTask < MaintenanceTasks::Task | ||
| def collection | ||
| LegalEntity::PayoutMethod::WiseTransfer.where.not(wise_recipient_id: nil).where.not("wise_recipient_id ~* ?", "^[0-9a-f-]{36}$") | ||
| end | ||
|
|
||
| def process(payout_method) | ||
| payout_method.wise_recipient_id_will_change! | ||
| payout_method.normalize_wise_recipient_id | ||
| payout_method.update_columns(wise_recipient_id: payout_method.wise_recipient_id) if payout_method.wise_recipient_id_changed? | ||
| end | ||
|
|
||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
spec/tasks/maintenance/normalize_wise_recipient_ids_task_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "rails_helper" | ||
|
|
||
| RSpec.describe Maintenance::NormalizeWiseRecipientIdsTask do | ||
| it "reduces a stored recipient URL to its UUID" do | ||
| payout_method = LegalEntity::PayoutMethod::WiseTransfer.new | ||
| payout_method.wise_recipient_id = "https://wise.com/recipients/86b41d15-1024-47ee-9e05-1891a912e450?new=undefined" | ||
| payout_method.clear_changes_information | ||
| allow(payout_method).to receive(:update_columns) | ||
|
|
||
| described_class.process(payout_method) | ||
|
|
||
| expect(payout_method).to have_received(:update_columns).with(wise_recipient_id: "86b41d15-1024-47ee-9e05-1891a912e450") | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.