Skip to content
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

Fix charity campaign/donations mock endpoints #300

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/mock_api/endpoints/charity/campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type GetCharityCampaignResponse struct {
CharityDescription string `json:"charity_description"`
CharityLogo string `json:"charity_logo"`
CharityWebsite string `json:"charity_website"`
CurrentAmount CharityAmount `json:"current_ammount"`
CurrentAmount CharityAmount `json:"current_amount"`
TargetAmount CharityAmount `json:"target_amount"`
}

Expand Down
22 changes: 12 additions & 10 deletions internal/mock_api/endpoints/charity/donations.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ var donationsScopesByMethod = map[string][]string{
type CharityDonations struct{}

type GetCharityDonationsResponse struct {
ID string `json:"campaign_id"`
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
TargetAmount CharityAmount `json:"target_amount"`
ID string `json:"id"`
CampaignID string `json:"campaign_id"`
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
Amount CharityAmount `json:"amount"`
}

func (e CharityDonations) Path() string { return "/charity/donations" }
Expand Down Expand Up @@ -98,11 +99,12 @@ func getCharityDonations(w http.ResponseWriter, r *http.Request) {

for i := 0; i < first; i++ {
d := GetCharityDonationsResponse{
ID: util.RandomGUID(),
UserID: userCtx.UserID,
UserName: user.DisplayName,
UserLogin: user.UserLogin,
TargetAmount: CharityAmount{
ID: util.RandomGUID(),
CampaignID: util.RandomGUID(),
UserID: userCtx.UserID,
UserName: user.DisplayName,
UserLogin: user.UserLogin,
Amount: CharityAmount{
Value: rand.Intn(150000-300) + 300, // Between $3 and $1,500
DecimalPlaces: 2,
Currency: "USD",
Expand Down
Loading