Skip to content

Commit

Permalink
Merge pull request #533 from stellar/release/3.4.0
Browse files Browse the repository at this point in the history
Release `3.4.0` to `main`
  • Loading branch information
marcelosalloum authored Feb 3, 2025
2 parents ab257b5 + 810cca0 commit 7066810
Show file tree
Hide file tree
Showing 17 changed files with 243 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
cache-dependency-path: go.sum

- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # version v6.1.1
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # version v6.2.0
with:
version: v1.56.2 # this is the golangci-lint version
args: --timeout 5m0s
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker_image_public_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push to DockerHub (release prd)
uses: docker/build-push-action@v6.11.0
uses: docker/build-push-action@v6.13.0
with:
push: true
build-args: |
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
run: echo "SHA=$(git rev-parse --short ${{ github.sha }} )" >> $GITHUB_OUTPUT

- name: Build and push to DockerHub (develop branch)
uses: docker/build-push-action@v6.11.0
uses: docker/build-push-action@v6.13.0
with:
push: true
build-args: |
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [3.4.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/3.4.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/3.3.0...3.4.0))

Release of the Stellar Disbursement Platform `v3.4.0`. This release adds support for `q={term}` query searches in the
`GET /payments` endpoint, and updates the CSV parser to ignore BOM (Byte Order Mark) characters.

> [!WARNING]
> This version is compatible with the [stellar/stellar-disbursement-platform-frontend] version `3.4.0`.
### Changed

- Update the `GET /payments` endpoint to accept `q={term}` query searches. [#530](https://github.com/stellar/stellar-disbursement-platform-backend/pull/530)
- Update the CSV parser to ignore BOM (Byte Order Mark) characters. [#531](https://github.com/stellar/stellar-disbursement-platform-backend/pull/531)

### Security and Dependencies

- Bump golang in the all-docker group. [#507](https://github.com/stellar/stellar-disbursement-platform-backend/pull/507)
- Bump the all-actions group. [#514](https://github.com/stellar/stellar-disbursement-platform-backend/pull/514)
- Bump the minor-and-patch group. [#529](https://github.com/stellar/stellar-disbursement-platform-backend/pull/529)

## [3.3.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/3.3.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/3.2.0...3.3.0))

Release of the Stellar Disbursement Platform `v3.3.0`. This release adds support to Circle's Transfers API, as an
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To push:
# make docker-push

FROM golang:1.23.4-bullseye AS build
FROM golang:1.23.5-bullseye AS build
ARG GIT_COMMIT

WORKDIR /src/stellar-disbursement-platform
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Build the Go application
FROM golang:1.23.4-bullseye AS build
FROM golang:1.23.5-bullseye AS build
ARG GIT_COMMIT

WORKDIR /src/stellar-disbursement-platform
Expand All @@ -9,7 +9,7 @@ COPY . ./
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .

# Stage 2: Setup the development environment with Delve for debugging
FROM golang:1.23.4-bullseye AS development
FROM golang:1.23.5-bullseye AS development

# set workdir according to repo structure so remote debug source code is in sync
WORKDIR /app/github.com/stellar/stellar-disbursement-platform
Expand Down
7 changes: 4 additions & 3 deletions go.list
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ github.com/armon/go-metrics v0.4.1
github.com/armon/go-radix v1.0.0
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/avast/retry-go/v4 v4.6.0
github.com/aws/aws-sdk-go v1.55.5
github.com/aws/aws-sdk-go v1.55.6
github.com/beevik/etree v1.1.0
github.com/beorn7/perks v1.0.1
github.com/bgentry/speakeasy v0.1.0
Expand All @@ -47,6 +47,7 @@ github.com/creachadair/mds v0.0.1
github.com/creack/pty v1.1.9
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/denisenkom/go-mssqldb v0.9.0
github.com/dimchansky/utfbom v1.1.1
github.com/distribution/reference v0.6.0
github.com/djherbis/fscache v0.10.1
github.com/docker/docker v27.3.1+incompatible
Expand Down Expand Up @@ -159,7 +160,7 @@ github.com/nats-io/nuid v1.0.1
github.com/nelsam/hel/v2 v2.3.3
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e
github.com/nxadm/tail v1.4.8
github.com/nyaruka/phonenumbers v1.4.4
github.com/nyaruka/phonenumbers v1.5.0
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.10
Expand Down Expand Up @@ -207,7 +208,7 @@ github.com/stellar/throttled v2.2.3-0.20190823235211-89d75816f59d+incompatible
github.com/stretchr/objx v0.5.2
github.com/stretchr/testify v1.10.0
github.com/subosito/gotenv v1.6.0
github.com/twilio/twilio-go v1.23.9
github.com/twilio/twilio-go v1.23.11
github.com/tyler-smith/go-bip39 v0.0.0-20180618194314-52158e4697b8
github.com/valyala/bytebufferpool v1.0.0
github.com/valyala/fasthttp v1.34.0
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ go 1.22.1
require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/avast/retry-go/v4 v4.6.0
github.com/aws/aws-sdk-go v1.55.5
github.com/aws/aws-sdk-go v1.55.6
github.com/dimchansky/utfbom v1.1.1
github.com/getsentry/sentry-go v0.31.1
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-chi/chi/v5 v5.2.0
Expand All @@ -18,7 +19,7 @@ require (
github.com/joho/godotenv v1.5.1
github.com/lib/pq v1.10.9
github.com/manifoldco/promptui v0.9.0
github.com/nyaruka/phonenumbers v1.4.4
github.com/nyaruka/phonenumbers v1.5.0
github.com/prometheus/client_golang v1.20.5
github.com/rs/cors v1.11.1
github.com/rubenv/sql-migrate v1.7.1
Expand All @@ -30,7 +31,7 @@ require (
github.com/spf13/viper v1.19.0
github.com/stellar/go v0.0.0-20241115082344-969db9917c2d
github.com/stretchr/testify v1.10.0
github.com/twilio/twilio-go v1.23.9
github.com/twilio/twilio-go v1.23.11
golang.org/x/crypto v0.32.0
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d
golang.org/x/net v0.34.0
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/avast/retry-go/v4 v4.6.0 h1:K9xNA+KeB8HHc2aWFuLb25Offp+0iVRXEvFx8IinRJA=
github.com/avast/retry-go/v4 v4.6.0/go.mod h1:gvWlPhBVsvBbLkVGDg/KwvBv0bEkCOLRRSHKIr2PyOE=
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand All @@ -32,6 +32,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
github.com/fatih/structs v1.0.0 h1:BrX964Rv5uQ3wwS+KRUAJCBBw5PQmgJfJ6v4yly5QwU=
github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down Expand Up @@ -118,8 +120,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/nyaruka/phonenumbers v1.4.4 h1:9yo9jLvXD7J4exe7GJATApgTlB+05snF0joMDL1p7nQ=
github.com/nyaruka/phonenumbers v1.4.4/go.mod h1:gv+CtldaFz+G3vHHnasBSirAi3O2XLqZzVWz4V1pl2E=
github.com/nyaruka/phonenumbers v1.5.0 h1:0M+Gd9zl53QC4Nl5z1Yj1O/zPk2XXBUwR/vlzdXSJv4=
github.com/nyaruka/phonenumbers v1.5.0/go.mod h1:gv+CtldaFz+G3vHHnasBSirAi3O2XLqZzVWz4V1pl2E=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
Expand Down Expand Up @@ -200,8 +202,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/twilio/twilio-go v1.23.9 h1:lzeeYez9PFT5aILZusqBf1yOEIlcom3J0CZU32bJkxk=
github.com/twilio/twilio-go v1.23.9/go.mod h1:zRkMjudW7v7MqQ3cWNZmSoZJ7EBjPZ4OpNh2zm7Q6ko=
github.com/twilio/twilio-go v1.23.11 h1:Q532m0rgWF1AzzF4Z4ejzTk5XeORWT+zLGzlklSk/iU=
github.com/twilio/twilio-go v1.23.11/go.mod h1:zRkMjudW7v7MqQ3cWNZmSoZJ7EBjPZ4OpNh2zm7Q6ko=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGGm4=
Expand Down
2 changes: 1 addition & 1 deletion helmchart/sdp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: stellar-disbursement-platform
description: A Helm chart for the Stellar Disbursement Platform Backend (A.K.A. `sdp`)
version: "3.3.0"
appVersion: "3.3.0"
appVersion: "3.4.0"
type: application
maintainers:
- name: Stellar Development Foundation
Expand Down
4 changes: 2 additions & 2 deletions helmchart/sdp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Configuration parameters for the SDP Core Service which is the core backend serv
| `sdp.image` | Configuration related to the Docker image used by the SDP service. | |
| `sdp.image.repository` | Docker image repository for the SDP backend service. | `stellar/stellar-disbursement-platform-backend` |
| `sdp.image.pullPolicy` | Image pull policy for the SDP service. For locally built images, consider using "Never" or "IfNotPresent". | `Always` |
| `sdp.image.tag` | Docker image tag for the SDP service. If set, this overrides the default value from `.Chart.AppVersion`. | `3.3.0` |
| `sdp.image.tag` | Docker image tag for the SDP service. If set, this overrides the default value from `.Chart.AppVersion`. | `3.4.0` |
| `sdp.deployment` | Configuration related to the deployment of the SDP service. | |
| `sdp.deployment.annotations` | Annotations to be added to the deployment. | `nil` |
| `sdp.deployment.podAnnotations` | Annotations specific to the pods. | `{}` |
Expand Down Expand Up @@ -291,7 +291,7 @@ Configuration parameters for the Dashboard. This is the user interface administr
| `dashboard.route.mtnDomain` | Public domain/address of the multi-tenant Dashboard. This is a wild-card domain used for multi-tenant setups e.g. "*.sdp-dashboard.localhost.com". | `nil` |
| `dashboard.route.port` | Primary port on which the Dashboard listens. | `80` |
| `dashboard.image` | Configuration related to the Docker image used by the Dashboard. | |
| `dashboard.image.fullName` | Full name of the Docker image. | `stellar/stellar-disbursement-platform-frontend:3.3.0` |
| `dashboard.image.fullName` | Full name of the Docker image. | `stellar/stellar-disbursement-platform-frontend:3.4.0` |
| `dashboard.image.pullPolicy` | Image pull policy for the dashboard. For locally built images, consider using "Never" or "IfNotPresent". | `Always` |
| `dashboard.deployment` | Configuration related to the deployment of the Dashboard. | |
| `dashboard.deployment.annotations` | Annotations to be added to the deployment. | `{}` |
Expand Down
4 changes: 2 additions & 2 deletions helmchart/sdp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ sdp:
image:
repository: stellar/stellar-disbursement-platform-backend
pullPolicy: Always
tag: "3.3.0"
tag: "3.4.0"

## @extra sdp.deployment Configuration related to the deployment of the SDP service.
## @param sdp.deployment.annotations Annotations to be added to the deployment.
Expand Down Expand Up @@ -536,7 +536,7 @@ dashboard:
## @param dashboard.image.fullName Full name of the Docker image.
## @param dashboard.image.pullPolicy Image pull policy for the dashboard. For locally built images, consider using "Never" or "IfNotPresent".
image:
fullName: stellar/stellar-disbursement-platform-frontend:3.3.0
fullName: stellar/stellar-disbursement-platform-frontend:3.4.0
pullPolicy: Always

## @extra dashboard.deployment Configuration related to the deployment of the Dashboard.
Expand Down
7 changes: 6 additions & 1 deletion internal/data/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func (p *PaymentModel) Count(ctx context.Context, queryParams *QueryParams, sqlE
payments p
JOIN disbursements d on p.disbursement_id = d.id
JOIN assets a on p.asset_id = a.id
JOIN wallets w on d.wallet_id = w.id
JOIN wallets w on d.wallet_id = w.id
JOIN receiver_wallets rw on rw.receiver_id = p.receiver_id AND rw.wallet_id = w.id
`

Expand Down Expand Up @@ -622,6 +622,11 @@ func (p *PaymentModel) GetByIDs(ctx context.Context, sqlExec db.SQLExecuter, pay
// newPaymentQuery generates the full query and parameters for a payment search query
func newPaymentQuery(baseQuery string, queryParams *QueryParams, sqlExec db.SQLExecuter, queryType QueryType) (string, []interface{}) {
qb := NewQueryBuilder(baseQuery)
if queryParams.Query != "" {
q := "%" + queryParams.Query + "%"
qb.AddCondition("(p.id ILIKE ? OR p.external_payment_id ILIKE ? OR rw.stellar_address ILIKE ? OR d.name ILIKE ?)", q, q, q, q)
}

if queryParams.Filters[FilterKeyStatus] != nil {
if statusSlice, ok := queryParams.Filters[FilterKeyStatus].([]PaymentStatus); ok {
if len(statusSlice) > 0 {
Expand Down
10 changes: 10 additions & 0 deletions internal/data/payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,16 @@ func Test_PaymentNewPaymentQuery(t *testing.T) {
expectedQuery: "SELECT * FROM payments p",
expectedParams: []interface{}{},
},
{
name: "build payment query with a query search",
baseQuery: "SELECT * FROM payments p",
queryParams: QueryParams{
Query: "foo-bar",
},
queryType: QueryTypeSelectAll,
expectedQuery: "SELECT * FROM payments p WHERE 1=1 AND (p.id ILIKE $1 OR p.external_payment_id ILIKE $2 OR rw.stellar_address ILIKE $3 OR d.name ILIKE $4)",
expectedParams: []interface{}{"%foo-bar%", "%foo-bar%", "%foo-bar%", "%foo-bar%"},
},
{
name: "build payment query with status filter",
baseQuery: "SELECT * FROM payments p",
Expand Down
34 changes: 21 additions & 13 deletions internal/serve/httphandler/disbursement_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"slices"
"time"

"github.com/dimchansky/utfbom"
"github.com/go-chi/chi/v5"
"github.com/gocarina/gocsv"
"github.com/stellar/go/support/log"
Expand Down Expand Up @@ -586,16 +587,23 @@ func parseInstructionsFromCSV(ctx context.Context, reader io.Reader, contactType

// validateCSVHeaders validates the headers of the CSV file to make sure we're passing the correct columns.
func validateCSVHeaders(file io.Reader, registrationContactType data.RegistrationContactType) error {
headers, err := csv.NewReader(file).Read()
const (
phoneHeader = "phone"
emailHeader = "email"
walletAddressHeader = "walletAddress"
verificationHeader = "verification"
)

headers, err := csv.NewReader(utfbom.SkipOnly(file)).Read()
if err != nil {
return fmt.Errorf("reading csv headers: %w", err)
}

hasHeaders := map[string]bool{
"phone": false,
"email": false,
"walletAddress": false,
"verification": false,
phoneHeader: false,
emailHeader: false,
walletAddressHeader: false,
verificationHeader: false,
}

// Populate header presence map
Expand All @@ -613,20 +621,20 @@ func validateCSVHeaders(file io.Reader, registrationContactType data.Registratio

rules := map[data.RegistrationContactType]headerRules{
data.RegistrationContactTypePhone: {
required: []string{"phone", "verification"},
disallowed: []string{"email", "walletAddress"},
required: []string{phoneHeader, verificationHeader},
disallowed: []string{emailHeader, walletAddressHeader},
},
data.RegistrationContactTypeEmail: {
required: []string{"email", "verification"},
disallowed: []string{"phone", "walletAddress"},
required: []string{emailHeader, verificationHeader},
disallowed: []string{phoneHeader, walletAddressHeader},
},
data.RegistrationContactTypeEmailAndWalletAddress: {
required: []string{"email", "walletAddress"},
disallowed: []string{"phone", "verification"},
required: []string{emailHeader, walletAddressHeader},
disallowed: []string{phoneHeader, verificationHeader},
},
data.RegistrationContactTypePhoneAndWalletAddress: {
required: []string{"phone", "walletAddress"},
disallowed: []string{"email", "verification"},
required: []string{phoneHeader, walletAddressHeader},
disallowed: []string{emailHeader, verificationHeader},
},
}

Expand Down
Loading

0 comments on commit 7066810

Please sign in to comment.