-
Notifications
You must be signed in to change notification settings - Fork 17
feat: implement provide profile availability #477
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this PR!
requested minor changes to clean up
// Remove: providerprofile.IsAvailableEQ(true), | ||
// Add: providerprofile.AvailableForContains(institution.Edges.FiatCurrency.Code), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
// Remove: providerprofile.IsAvailable(true), | ||
// The currency filter will be handled in CreatePriorityQueueForBucket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
// Remove: providerprofile.IsAvailableEQ(true), | ||
// Add: providerprofile.AvailableForContains(bucketCurrency.Code), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
// providerprofile.IsAvailableEQ(true), // REMOVE this line | ||
providerprofile.AvailableForContains(currency.Code), // ADD this line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
// .SetIsAvailable(payload["is_available"].(bool)). // REMOVE this line | ||
SetAvailableFor(payload["available_for"].([]string)). // ADD this line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
@@ -457,7 +457,7 @@ func CreateTestProviderProfile(overrides map[string]interface{}) (*ent.ProviderP | |||
"provision_mode": "auto", | |||
"is_partner": false, | |||
"visibility_mode": "public", | |||
"is_available": true, | |||
"available_for": []string{"USD"}, // <-- Use available_for instead of is_available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
@@ -876,7 +876,7 @@ func (s *IndexerService) IndexOrderRefundedTron(ctx context.Context, order *ent. | |||
logger.WithFields(logger.Fields{ | |||
"Error": fmt.Sprintf("%v", err), | |||
"TxHash": order.TxHash, | |||
}).Errorf("Failed to fetch event logs for %s", order.Edges.Token.Edges.Network.Identifier) | |||
}).Errorf("Failed to fetch trx info by id for %s", order.Edges.Token.Edges.Network.Identifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert indexer change
@@ -885,7 +885,7 @@ func (s *IndexerService) IndexOrderRefundedTron(ctx context.Context, order *ent. | |||
logger.WithFields(logger.Fields{ | |||
"Error": fmt.Sprintf("%v", err), | |||
"Response": data, | |||
}).Errorf("Failed to parse JSON response for %s after fetching event logs", order.Edges.Token.Edges.Network.Identifier) | |||
}).Errorf("Failed to parse JSON response for %s", order.Edges.Token.Edges.Network.Identifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert indexer change
Description
This PR updates the test utilities to support the new provider availability model, as part of the migration from a boolean
is_available
field to a currency-specificavailable_for
array. All test helpers and test data creation now useavailable_for
(an array of ISO currency codes) to set and assert provider availability. This aligns the test setup with the new business logic, ensuring that providers can be tested for availability on a per-currency basis.Key changes:
IsAvailable
and theis_available
field from test helpers.AvailableFor
and theavailable_for
field for currency-specific provider availability.available_for
as an array of ISO currency codes.This change is required for the new matching logic and API, and ensures that tests accurately reflect the updated provider profile structure.
References
Testing
All unit and integration tests have been updated to use the new
available_for
field.Manual testing:
Developed and tested on Go 1.21, Postgres 14, MacOS 14, and Docker Compose environment.
This change adds test coverage for new/changed/fixed functionality
Checklist
main
By submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.