diff --git a/components/payments/.gitignore b/components/payments/.gitignore index 0f1636bb23..d06895e913 100644 --- a/components/payments/.gitignore +++ b/components/payments/.gitignore @@ -1,3 +1,4 @@ +plugins .DS_Store .idea vendor diff --git a/components/payments/Earthfile b/components/payments/Earthfile index 3a3cabee19..ffad3949f6 100644 --- a/components/payments/Earthfile +++ b/components/payments/Earthfile @@ -38,6 +38,7 @@ compile-plugins: DO --pass-args core+GO_COMPILE --VERSION=$VERSION WORKDIR /src SAVE ARTIFACT /src/components/payments/internal/connectors/plugins/public/$c/cmd/main ./plugins/$c + SAVE ARTIFACT /src/components/payments/internal/connectors/plugins/public/$c/cmd/main AS LOCAL ./plugins/$c END compile: diff --git a/components/payments/docker-compose.yml b/components/payments/docker-compose.yml index 8ae8ea6ad7..b7a48a22e1 100644 --- a/components/payments/docker-compose.yml +++ b/components/payments/docker-compose.yml @@ -28,11 +28,47 @@ services: condition: service_healthy volumes: - .:/app/components/payments - - ../../libs:/app/libs working_dir: /app/components/payments environment: POSTGRES_URI: postgres://payments:payments@postgres:${POSTGRES_PORT:-5432}/payments?sslmode=disable + temporal: + image: temporalio/auto-setup:1.25.0 + depends_on: + postgres: + condition: service_healthy + environment: + DB: postgres12 + DB_PORT: 5432 + POSTGRES_USER: payments + POSTGRES_PWD: payments + POSTGRES_SEEDS: postgres + DYNAMIC_CONFIG_FILE_PATH: config/dynamicconfig/development-sql.yaml + ports: + - 7233:7233 + volumes: + - ./local_env/postgres/temporal-sql.yaml:/etc/temporal/config/dynamicconfig/development-sql.yaml + temporal-admin-tools: + container_name: temporal-admin-tools + depends_on: + - temporal + environment: + - TEMPORAL_ADDRESS=temporal:7233 + - TEMPORAL_CLI_ADDRESS=temporal:7233 + image: temporalio/admin-tools:1.25.0-tctl-1.18.1-cli-1.0.0 + stdin_open: true + tty: true + temporal-ui: + container_name: temporal-ui + depends_on: + - temporal + environment: + - TEMPORAL_ADDRESS=temporal:7233 + - TEMPORAL_CORS_ORIGINS=http://localhost:3000 + image: temporalio/ui:2.26.2 + ports: + - 8081:8080 + payments: image: golang:1.22.4-alpine3.19 command: go run ./ server @@ -50,11 +86,12 @@ services: - "8080:8080" volumes: - .:/app/components/payments - - ../../libs:/app/libs working_dir: /app/components/payments environment: - DEBUG: ${DEBUG:-"true"} + DEBUG: true POSTGRES_URI: postgres://payments:payments@postgres:${POSTGRES_PORT:-5432}/payments?sslmode=disable CONFIG_ENCRYPTION_KEY: mysuperencryptionkey - -# TODO(polo): add temporal \ No newline at end of file + TEMPORAL_ADDRESS: temporal:7233 + PLUGIN_MAGIC_COOKIE: mysupercookie + PLUGIN_DIRECTORY_PATH: /app/components/payments/plugins + TEMPORAL_INIT_SEARCH_ATTRIBUTES: true \ No newline at end of file diff --git a/components/payments/go.mod b/components/payments/go.mod index f154afbf95..7335a7fdf7 100644 --- a/components/payments/go.mod +++ b/components/payments/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.7 require ( github.com/ThreeDotsLabs/watermill v1.3.7 github.com/bombsimon/logrusr/v3 v3.1.0 - github.com/formancehq/go-libs v1.7.2-0.20240926150224-306278b90e0c + github.com/formancehq/go-libs v1.7.2-0.20240927101303-a8e108b39d15 github.com/formancehq/payments/genericclient v0.0.0-00010101000000-000000000000 github.com/gibson042/canonicaljson-go v1.0.3 github.com/go-chi/chi/v5 v5.1.0 diff --git a/components/payments/go.sum b/components/payments/go.sum index e631f9131f..745c727e4b 100644 --- a/components/payments/go.sum +++ b/components/payments/go.sum @@ -100,8 +100,8 @@ github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/formancehq/go-libs v1.7.2-0.20240926150224-306278b90e0c h1:fSPJ3x4ofe+9bnrS1pr1+9r0SAaxhJ5Jw4k4wKEUTwk= -github.com/formancehq/go-libs v1.7.2-0.20240926150224-306278b90e0c/go.mod h1:ynmWBbsdhVyjE+MxneMErtgd/RnNAk892VuIhZE2fps= +github.com/formancehq/go-libs v1.7.2-0.20240927101303-a8e108b39d15 h1:a/STc7qwGyEX3itlrLgVJoB0N8IGA9TJ+xPeQns7Lsk= +github.com/formancehq/go-libs v1.7.2-0.20240927101303-a8e108b39d15/go.mod h1:ynmWBbsdhVyjE+MxneMErtgd/RnNAk892VuIhZE2fps= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= diff --git a/components/payments/internal/connectors/plugins/public/bankingcircle/client/auth.go b/components/payments/internal/connectors/plugins/public/bankingcircle/client/auth.go index 83675bbbb2..244fcf77ba 100644 --- a/components/payments/internal/connectors/plugins/public/bankingcircle/client/auth.go +++ b/components/payments/internal/connectors/plugins/public/bankingcircle/client/auth.go @@ -46,7 +46,6 @@ func (c *Client) login(ctx context.Context) error { } return fmt.Errorf("failed to login: %d", statusCode) } - return fmt.Errorf("failed make login request: %w", err) c.accessToken = res.AccessToken expiresIn, err := strconv.Atoi(res.ExpiresIn) diff --git a/components/payments/local_env/postgres/init.sql b/components/payments/local_env/postgres/init.sql new file mode 100644 index 0000000000..2945c921e9 --- /dev/null +++ b/components/payments/local_env/postgres/init.sql @@ -0,0 +1 @@ +ALTER ROLE payments SET search_path = public; \ No newline at end of file diff --git a/components/payments/local_env/postgres/temporal-sql.yaml b/components/payments/local_env/postgres/temporal-sql.yaml new file mode 100644 index 0000000000..228c752f5b --- /dev/null +++ b/components/payments/local_env/postgres/temporal-sql.yaml @@ -0,0 +1,6 @@ +limit.maxIDLength: + - value: 255 + constraints: {} +system.forceSearchAttributesCacheRefreshOnRead: + - value: true # Dev setup only. Please don't turn this on in production. + constraints: {} \ No newline at end of file diff --git a/tests/integration/go.mod b/tests/integration/go.mod index 3d3a72ab7e..5cb0248314 100644 --- a/tests/integration/go.mod +++ b/tests/integration/go.mod @@ -9,7 +9,8 @@ require ( github.com/egymgmbh/go-prefix-writer v0.0.0-20180609083313-7326ea162eca github.com/formancehq/auth v0.0.0-00010101000000-000000000000 github.com/formancehq/formance-sdk-go/v2 v2.0.0-00010101000000-000000000000 - github.com/formancehq/go-libs v1.7.2-0.20240926150224-306278b90e0c + github.com/formancehq/formance-sdk-go/v3 v3.0.0 + github.com/formancehq/go-libs v1.7.2-0.20240927101303-a8e108b39d15 github.com/formancehq/ledger v0.0.0-00010101000000-000000000000 github.com/formancehq/orchestration v0.0.0-00010101000000-000000000000 github.com/formancehq/payments v0.0.0-00010101000000-000000000000 diff --git a/tests/integration/go.sum b/tests/integration/go.sum index ff7b2134f7..7dcb73e5ea 100644 --- a/tests/integration/go.sum +++ b/tests/integration/go.sum @@ -138,8 +138,10 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/formancehq/go-libs v1.7.2-0.20240926150224-306278b90e0c h1:fSPJ3x4ofe+9bnrS1pr1+9r0SAaxhJ5Jw4k4wKEUTwk= -github.com/formancehq/go-libs v1.7.2-0.20240926150224-306278b90e0c/go.mod h1:ynmWBbsdhVyjE+MxneMErtgd/RnNAk892VuIhZE2fps= +github.com/formancehq/formance-sdk-go/v3 v3.0.0 h1:UIzVMJSPUBUSm29Zg50tZjM0f101WeWHYlu0ClfUk2c= +github.com/formancehq/formance-sdk-go/v3 v3.0.0/go.mod h1:ZBBYCgtDgde68qMW5nZ9lfliM8W1D3ZI/BpZ+RdhD3c= +github.com/formancehq/go-libs v1.7.2-0.20240927101303-a8e108b39d15 h1:a/STc7qwGyEX3itlrLgVJoB0N8IGA9TJ+xPeQns7Lsk= +github.com/formancehq/go-libs v1.7.2-0.20240927101303-a8e108b39d15/go.mod h1:ynmWBbsdhVyjE+MxneMErtgd/RnNAk892VuIhZE2fps= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=