diff --git a/api/billing/fees/go.mod b/api/billing/fees/go.mod index 0827803..c25fd37 100644 --- a/api/billing/fees/go.mod +++ b/api/billing/fees/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/billing/fees/go.sum b/api/billing/fees/go.sum index 1f4c761..e0b6426 100644 --- a/api/billing/fees/go.sum +++ b/api/billing/fees/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/fx/ingestor/go.mod b/api/fx/ingestor/go.mod index d2d6a1e..67902a3 100644 --- a/api/fx/ingestor/go.mod +++ b/api/fx/ingestor/go.mod @@ -20,7 +20,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/fx/ingestor/go.sum b/api/fx/ingestor/go.sum index 1f4c761..e0b6426 100644 --- a/api/fx/ingestor/go.sum +++ b/api/fx/ingestor/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/fx/oracle/go.mod b/api/fx/oracle/go.mod index 5794037..36a3ecc 100644 --- a/api/fx/oracle/go.mod +++ b/api/fx/oracle/go.mod @@ -21,7 +21,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/fx/oracle/go.sum b/api/fx/oracle/go.sum index 1f4c761..e0b6426 100644 --- a/api/fx/oracle/go.sum +++ b/api/fx/oracle/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/fx/storage/go.mod b/api/fx/storage/go.mod index 345ccaa..8b29672 100644 --- a/api/fx/storage/go.mod +++ b/api/fx/storage/go.mod @@ -12,7 +12,7 @@ require ( require ( github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/golang/snappy v1.0.0 // indirect diff --git a/api/fx/storage/go.sum b/api/fx/storage/go.sum index f9113c6..22e4b2b 100644 --- a/api/fx/storage/go.sum +++ b/api/fx/storage/go.sum @@ -7,8 +7,8 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/gateway/chain/go.mod b/api/gateway/chain/go.mod index 16344da..c837405 100644 --- a/api/gateway/chain/go.mod +++ b/api/gateway/chain/go.mod @@ -26,7 +26,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.24.4 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect diff --git a/api/gateway/chain/go.sum b/api/gateway/chain/go.sum index 73e1cf8..b506dd0 100644 --- a/api/gateway/chain/go.sum +++ b/api/gateway/chain/go.sum @@ -17,8 +17,8 @@ github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6 github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/gateway/mntx/go.mod b/api/gateway/mntx/go.mod index 904e688..b81ea94 100644 --- a/api/gateway/mntx/go.mod +++ b/api/gateway/mntx/go.mod @@ -19,7 +19,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/gateway/mntx/go.sum b/api/gateway/mntx/go.sum index cae6cd3..559c5a4 100644 --- a/api/gateway/mntx/go.sum +++ b/api/gateway/mntx/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/ledger/go.mod b/api/ledger/go.mod index 19013dd..accc32f 100644 --- a/api/ledger/go.mod +++ b/api/ledger/go.mod @@ -19,7 +19,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/ledger/go.sum b/api/ledger/go.sum index 3f90d69..c62d293 100644 --- a/api/ledger/go.sum +++ b/api/ledger/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/notification/go.mod b/api/notification/go.mod index c9ba580..3596fc5 100644 --- a/api/notification/go.mod +++ b/api/notification/go.mod @@ -21,7 +21,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/notification/go.sum b/api/notification/go.sum index dee973a..b53d743 100644 --- a/api/notification/go.sum +++ b/api/notification/go.sum @@ -13,8 +13,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/payments/orchestrator/go.mod b/api/payments/orchestrator/go.mod index 9e382ca..8e1bfc1 100644 --- a/api/payments/orchestrator/go.mod +++ b/api/payments/orchestrator/go.mod @@ -29,7 +29,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect github.com/casbin/mongodb-adapter/v3 v3.7.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/api/payments/orchestrator/go.sum b/api/payments/orchestrator/go.sum index 6039d97..e8c89e3 100644 --- a/api/payments/orchestrator/go.sum +++ b/api/payments/orchestrator/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/payments/orchestrator/internal/service/orchestrator/execution.go b/api/payments/orchestrator/internal/service/orchestrator/execution.go index b43362a..422dd23 100644 --- a/api/payments/orchestrator/internal/service/orchestrator/execution.go +++ b/api/payments/orchestrator/internal/service/orchestrator/execution.go @@ -10,6 +10,8 @@ import ( "github.com/tech/sendico/payments/orchestrator/storage/model" "github.com/tech/sendico/pkg/merrors" feesv1 "github.com/tech/sendico/pkg/proto/billing/fees/v1" + fxv1 "github.com/tech/sendico/pkg/proto/common/fx/v1" + moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1" chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1" ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1" oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1" @@ -22,12 +24,38 @@ import ( func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest) (*orchestratorv1.PaymentQuote, time.Time, error) { intent := req.GetIntent() amount := intent.GetAmount() - baseAmount := cloneMoney(amount) - feeQuote, err := s.quoteFees(ctx, orgRef, req) + fxSide := fxv1.Side_SIDE_UNSPECIFIED + if intent.GetFx() != nil { + fxSide = intent.GetFx().GetSide() + } + + var fxQuote *oraclev1.Quote + var err error + if shouldRequestFX(intent) { + fxQuote, err = s.requestFXQuote(ctx, orgRef, req) + if err != nil { + return nil, time.Time{}, err + } + } + + payAmount, settlementAmountBeforeFees := resolveTradeAmounts(amount, fxQuote, fxSide) + + feeBaseAmount := payAmount + if feeBaseAmount == nil { + feeBaseAmount = cloneMoney(amount) + } + + feeQuote, err := s.quoteFees(ctx, orgRef, req, feeBaseAmount) if err != nil { return nil, time.Time{}, err } - feeTotal := extractFeeTotal(feeQuote.GetLines(), amount.GetCurrency()) + feeCurrency := "" + if feeBaseAmount != nil { + feeCurrency = feeBaseAmount.GetCurrency() + } else if amount != nil { + feeCurrency = amount.GetCurrency() + } + feeTotal := extractFeeTotal(feeQuote.GetLines(), feeCurrency) var networkFee *chainv1.EstimateTransferFeeResponse if shouldEstimateNetworkFee(intent) { @@ -37,15 +65,7 @@ func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orc } } - var fxQuote *oraclev1.Quote - if shouldRequestFX(intent) { - fxQuote, err = s.requestFXQuote(ctx, orgRef, req) - if err != nil { - return nil, time.Time{}, err - } - } - - debitAmount, settlementAmount := computeAggregates(baseAmount, feeTotal, networkFee) + debitAmount, settlementAmount := computeAggregates(payAmount, settlementAmountBeforeFees, feeTotal, networkFee, fxQuote) quote := &orchestratorv1.PaymentQuote{ DebitAmount: debitAmount, @@ -63,14 +83,18 @@ func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orc return quote, expiresAt, nil } -func (s *Service) quoteFees(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest) (*feesv1.PrecomputeFeesResponse, error) { +func (s *Service) quoteFees(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest, baseAmount *moneyv1.Money) (*feesv1.PrecomputeFeesResponse, error) { if !s.fees.available() { return &feesv1.PrecomputeFeesResponse{}, nil } intent := req.GetIntent() + amount := cloneMoney(baseAmount) + if amount == nil { + amount = cloneMoney(intent.GetAmount()) + } feeIntent := &feesv1.Intent{ Trigger: triggerFromKind(intent.GetKind(), intent.GetRequiresFx()), - BaseAmount: cloneMoney(intent.GetAmount()), + BaseAmount: amount, BookedAt: timestamppb.New(s.clock.Now()), OriginType: "payments.orchestrator.quote", OriginRef: strings.TrimSpace(req.GetIdempotencyKey()), @@ -164,7 +188,19 @@ func (s *Service) requestFXQuote(ctx context.Context, orgRef string, req *orches } if amount := intent.GetAmount(); amount != nil { - params.BaseAmount = cloneMoney(amount) + pair := fxIntent.GetPair() + if pair != nil { + switch { + case strings.EqualFold(amount.GetCurrency(), pair.GetBase()): + params.BaseAmount = cloneMoney(amount) + case strings.EqualFold(amount.GetCurrency(), pair.GetQuote()): + params.QuoteAmount = cloneMoney(amount) + default: + params.BaseAmount = cloneMoney(amount) + } + } else { + params.BaseAmount = cloneMoney(amount) + } } quote, err := s.oracle.client.GetQuote(ctx, params) @@ -291,11 +327,14 @@ func (s *Service) applyFX(ctx context.Context, payment *model.Payment, quote *or if fq == nil { return merrors.InvalidArgument("ledger: fx quote missing") } - fromMoney := cloneMoney(fq.GetBaseAmount()) + fxSide := fxv1.Side_SIDE_UNSPECIFIED + if intent.FX != nil { + fxSide = intent.FX.Side + } + fromMoney, toMoney := resolveTradeAmounts(intent.Amount, fq, fxSide) if fromMoney == nil { fromMoney = cloneMoney(intent.Amount) } - toMoney := cloneMoney(fq.GetQuoteAmount()) if toMoney == nil { toMoney = cloneMoney(quote.GetExpectedSettlementAmount()) } diff --git a/api/payments/orchestrator/internal/service/orchestrator/helpers.go b/api/payments/orchestrator/internal/service/orchestrator/helpers.go index bbae435..9d6625a 100644 --- a/api/payments/orchestrator/internal/service/orchestrator/helpers.go +++ b/api/payments/orchestrator/internal/service/orchestrator/helpers.go @@ -14,6 +14,7 @@ import ( feesv1 "github.com/tech/sendico/pkg/proto/billing/fees/v1" accountingv1 "github.com/tech/sendico/pkg/proto/common/accounting/v1" + fxv1 "github.com/tech/sendico/pkg/proto/common/fx/v1" moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1" chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1" ) @@ -109,30 +110,91 @@ func extractFeeTotal(lines []*feesv1.DerivedPostingLine, currency string) *money } } -func computeAggregates(base, fee *moneyv1.Money, network *chainv1.EstimateTransferFeeResponse) (*moneyv1.Money, *moneyv1.Money) { - if base == nil { +func resolveTradeAmounts(intentAmount *moneyv1.Money, fxQuote *oraclev1.Quote, side fxv1.Side) (*moneyv1.Money, *moneyv1.Money) { + if fxQuote == nil { + return cloneMoney(intentAmount), cloneMoney(intentAmount) + } + qSide := fxQuote.GetSide() + if qSide == fxv1.Side_SIDE_UNSPECIFIED { + qSide = side + } + + switch qSide { + case fxv1.Side_BUY_BASE_SELL_QUOTE: + pay := cloneMoney(fxQuote.GetQuoteAmount()) + settle := cloneMoney(fxQuote.GetBaseAmount()) + if pay == nil { + pay = cloneMoney(intentAmount) + } + if settle == nil { + settle = cloneMoney(intentAmount) + } + return pay, settle + case fxv1.Side_SELL_BASE_BUY_QUOTE: + pay := cloneMoney(fxQuote.GetBaseAmount()) + settle := cloneMoney(fxQuote.GetQuoteAmount()) + if pay == nil { + pay = cloneMoney(intentAmount) + } + if settle == nil { + settle = cloneMoney(intentAmount) + } + return pay, settle + default: + return cloneMoney(intentAmount), cloneMoney(intentAmount) + } +} + +func computeAggregates(pay, settlement, fee *moneyv1.Money, network *chainv1.EstimateTransferFeeResponse, fxQuote *oraclev1.Quote) (*moneyv1.Money, *moneyv1.Money) { + if pay == nil { return nil, nil } - baseDecimal, err := decimalFromMoney(base) + debitDecimal, err := decimalFromMoney(pay) if err != nil { - return cloneMoney(base), cloneMoney(base) - } - debit := baseDecimal - settlement := baseDecimal - - if feeDecimal, err := decimalFromMoneyMatching(base, fee); err == nil && feeDecimal != nil { - debit = debit.Add(*feeDecimal) - settlement = settlement.Sub(*feeDecimal) + return cloneMoney(pay), cloneMoney(settlement) } - if network != nil && network.GetNetworkFee() != nil { - if networkDecimal, err := decimalFromMoneyMatching(base, network.GetNetworkFee()); err == nil && networkDecimal != nil { - debit = debit.Add(*networkDecimal) - settlement = settlement.Sub(*networkDecimal) + settlementCurrency := pay.GetCurrency() + if settlement != nil && strings.TrimSpace(settlement.GetCurrency()) != "" { + settlementCurrency = settlement.GetCurrency() + } + + settlementDecimal := debitDecimal + if settlement != nil { + if val, err := decimalFromMoney(settlement); err == nil { + settlementDecimal = val } } - return makeMoney(base.GetCurrency(), debit), makeMoney(base.GetCurrency(), settlement) + adjustDebit := func(m *moneyv1.Money) { + converted, err := ensureCurrency(m, pay.GetCurrency(), fxQuote) + if err != nil || converted == nil { + return + } + if val, err := decimalFromMoney(converted); err == nil { + debitDecimal = debitDecimal.Add(val) + } + } + + adjustSettlement := func(m *moneyv1.Money) { + converted, err := ensureCurrency(m, settlementCurrency, fxQuote) + if err != nil || converted == nil { + return + } + if val, err := decimalFromMoney(converted); err == nil { + settlementDecimal = settlementDecimal.Sub(val) + } + } + + adjustDebit(fee) + adjustSettlement(fee) + + if network != nil && network.GetNetworkFee() != nil { + adjustDebit(network.GetNetworkFee()) + adjustSettlement(network.GetNetworkFee()) + } + + return makeMoney(pay.GetCurrency(), debitDecimal), makeMoney(settlementCurrency, settlementDecimal) } func decimalFromMoney(m *moneyv1.Money) (decimal.Decimal, error) { @@ -163,6 +225,46 @@ func makeMoney(currency string, value decimal.Decimal) *moneyv1.Money { } } +func ensureCurrency(m *moneyv1.Money, targetCurrency string, quote *oraclev1.Quote) (*moneyv1.Money, error) { + if m == nil || strings.TrimSpace(targetCurrency) == "" { + return nil, nil + } + if strings.EqualFold(m.GetCurrency(), targetCurrency) { + return cloneMoney(m), nil + } + return convertWithQuote(m, quote, targetCurrency) +} + +func convertWithQuote(m *moneyv1.Money, quote *oraclev1.Quote, targetCurrency string) (*moneyv1.Money, error) { + if m == nil || quote == nil || quote.GetPair() == nil || quote.GetPrice() == nil { + return nil, nil + } + + base := strings.TrimSpace(quote.GetPair().GetBase()) + qt := strings.TrimSpace(quote.GetPair().GetQuote()) + if base == "" || qt == "" || strings.TrimSpace(targetCurrency) == "" { + return nil, nil + } + + price, err := decimal.NewFromString(quote.GetPrice().GetValue()) + if err != nil || price.IsZero() { + return nil, err + } + value, err := decimalFromMoney(m) + if err != nil { + return nil, err + } + + switch { + case strings.EqualFold(m.GetCurrency(), base) && strings.EqualFold(targetCurrency, qt): + return makeMoney(targetCurrency, value.Mul(price)), nil + case strings.EqualFold(m.GetCurrency(), qt) && strings.EqualFold(targetCurrency, base): + return makeMoney(targetCurrency, value.Div(price)), nil + default: + return nil, nil + } +} + func quoteToProto(src *oracleclient.Quote) *oraclev1.Quote { if src == nil { return nil diff --git a/api/payments/orchestrator/internal/service/orchestrator/helpers_test.go b/api/payments/orchestrator/internal/service/orchestrator/helpers_test.go new file mode 100644 index 0000000..8c7bbd8 --- /dev/null +++ b/api/payments/orchestrator/internal/service/orchestrator/helpers_test.go @@ -0,0 +1,57 @@ +package orchestrator + +import ( + "testing" + + fxv1 "github.com/tech/sendico/pkg/proto/common/fx/v1" + moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1" + chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1" + oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1" +) + +func TestResolveTradeAmountsBuyBase(t *testing.T) { + fxQuote := &oraclev1.Quote{ + Side: fxv1.Side_BUY_BASE_SELL_QUOTE, + Pair: &fxv1.CurrencyPair{Base: "EUR", Quote: "USD"}, + BaseAmount: &moneyv1.Money{ + Currency: "EUR", + Amount: "100", + }, + QuoteAmount: &moneyv1.Money{ + Currency: "USD", + Amount: "110", + }, + } + + pay, settle := resolveTradeAmounts(nil, fxQuote, fxv1.Side_SIDE_UNSPECIFIED) + if pay.GetCurrency() != "USD" || pay.GetAmount() != "110" { + t.Fatalf("expected pay amount in USD 110, got %s %s", pay.GetCurrency(), pay.GetAmount()) + } + if settle.GetCurrency() != "EUR" || settle.GetAmount() != "100" { + t.Fatalf("expected settlement in EUR 100, got %s %s", settle.GetCurrency(), settle.GetAmount()) + } +} + +func TestComputeAggregatesConvertsCurrencies(t *testing.T) { + pay := &moneyv1.Money{Currency: "USD", Amount: "100"} + settle := &moneyv1.Money{Currency: "EUR", Amount: "50"} + fee := &moneyv1.Money{Currency: "USD", Amount: "10"} + network := &chainv1.EstimateTransferFeeResponse{ + NetworkFee: &moneyv1.Money{Currency: "USD", Amount: "5"}, + } + fxQuote := &oraclev1.Quote{ + Pair: &fxv1.CurrencyPair{Base: "EUR", Quote: "USD"}, + Side: fxv1.Side_BUY_BASE_SELL_QUOTE, + Price: &moneyv1.Decimal{ + Value: "2", + }, + } + + debit, settlement := computeAggregates(pay, settle, fee, network, fxQuote) + if debit.GetCurrency() != "USD" || debit.GetAmount() != "115" { + t.Fatalf("expected debit 115 USD, got %s %s", debit.GetCurrency(), debit.GetAmount()) + } + if settlement.GetCurrency() != "EUR" || settlement.GetAmount() != "42.5" { + t.Fatalf("expected settlement 42.5 EUR, got %s %s", settlement.GetCurrency(), settlement.GetAmount()) + } +} diff --git a/api/payments/orchestrator/internal/service/orchestrator/quote_request_test.go b/api/payments/orchestrator/internal/service/orchestrator/quote_request_test.go new file mode 100644 index 0000000..674a2bd --- /dev/null +++ b/api/payments/orchestrator/internal/service/orchestrator/quote_request_test.go @@ -0,0 +1,64 @@ +package orchestrator + +import ( + "context" + "testing" + "time" + + oracleclient "github.com/tech/sendico/fx/oracle/client" + fxv1 "github.com/tech/sendico/pkg/proto/common/fx/v1" + moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1" + orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1" + "go.uber.org/zap" +) + +func TestRequestFXQuoteUsesQuoteAmountWhenCurrencyMatchesQuote(t *testing.T) { + ctx := context.Background() + var captured oracleclient.GetQuoteParams + + svc := &Service{ + logger: zap.NewNop(), + clock: testClock{now: time.Now()}, + oracle: oracleDependency{ + client: &oracleclient.Fake{ + GetQuoteFn: func(ctx context.Context, params oracleclient.GetQuoteParams) (*oracleclient.Quote, error) { + captured = params + return &oracleclient.Quote{ + QuoteRef: "q", + Pair: params.Pair, + Side: params.Side, + Price: "1.1", + BaseAmount: params.BaseAmount, + QuoteAmount: params.QuoteAmount, + ExpiresAt: time.Now(), + }, nil + }, + }, + }, + } + + req := &orchestratorv1.QuotePaymentRequest{ + Meta: &orchestratorv1.RequestMeta{OrganizationRef: "org"}, + Intent: &orchestratorv1.PaymentIntent{ + Amount: &moneyv1.Money{Currency: "USD", Amount: "100"}, + Fx: &orchestratorv1.FXIntent{ + Pair: &fxv1.CurrencyPair{Base: "EUR", Quote: "USD"}, + Side: fxv1.Side_BUY_BASE_SELL_QUOTE, + }, + }, + } + + if _, err := svc.requestFXQuote(ctx, "org", req); err != nil { + t.Fatalf("requestFXQuote returned error: %v", err) + } + + if captured.QuoteAmount == nil { + t.Fatal("expected quote amount to be populated") + } + if captured.BaseAmount != nil { + t.Fatal("expected base amount to be nil when using quote amount input") + } + if captured.QuoteAmount.GetCurrency() != "USD" { + t.Fatalf("expected quote amount currency USD, got %s", captured.QuoteAmount.GetCurrency()) + } +} diff --git a/api/payments/orchestrator/storage/mongo/store/quotes.go b/api/payments/orchestrator/storage/mongo/store/quotes.go index 2c369ee..f8c0a63 100644 --- a/api/payments/orchestrator/storage/mongo/store/quotes.go +++ b/api/payments/orchestrator/storage/mongo/store/quotes.go @@ -36,8 +36,8 @@ func NewQuotes(logger mlogger.Logger, repo repository.Repository) (*Quotes, erro Keys: []ri.Key{{Field: "organizationRef", Sort: ri.Asc}}, }, { - Keys: []ri.Key{{Field: "expiresAt", Sort: ri.Asc}}, - ExpireAfterSeconds: 0, + Keys: []ri.Key{{Field: "expiresAt", Sort: ri.Asc}}, + TTL: int32Ptr(0), }, } @@ -111,3 +111,7 @@ func (q *Quotes) GetByRef(ctx context.Context, orgRef primitive.ObjectID, quoteR } var _ storage.QuotesStore = (*Quotes)(nil) + +func int32Ptr(v int32) *int32 { + return &v +} diff --git a/api/pkg/go.mod b/api/pkg/go.mod index 4dbe687..ca7a5f7 100644 --- a/api/pkg/go.mod +++ b/api/pkg/go.mod @@ -3,7 +3,7 @@ module github.com/tech/sendico/pkg go 1.24.0 require ( - github.com/casbin/casbin/v2 v2.134.0 + github.com/casbin/casbin/v2 v2.135.0 github.com/casbin/mongodb-adapter/v3 v3.7.0 github.com/go-chi/chi/v5 v5.2.3 github.com/google/uuid v1.6.0 diff --git a/api/pkg/go.sum b/api/pkg/go.sum index 253e4ae..1336402 100644 --- a/api/pkg/go.sum +++ b/api/pkg/go.sum @@ -11,8 +11,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/server/go.mod b/api/server/go.mod index bf84e2a..6161452 100644 --- a/api/server/go.mod +++ b/api/server/go.mod @@ -38,7 +38,7 @@ require ( require ( github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect - github.com/casbin/casbin/v2 v2.134.0 // indirect + github.com/casbin/casbin/v2 v2.135.0 // indirect github.com/casbin/govaluate v1.10.0 // indirect ) diff --git a/api/server/go.sum b/api/server/go.sum index c9ffe33..7d3b2c4 100644 --- a/api/server/go.sum +++ b/api/server/go.sum @@ -50,8 +50,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/casbin/casbin/v2 v2.134.0 h1:wyO3hZb487GzlGVAI2hUoHQT0ehFD+9B5P+HVG9BVTM= -github.com/casbin/casbin/v2 v2.134.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= +github.com/casbin/casbin/v2 v2.135.0 h1:6BLkMQiGotYyS5yYeWgW19vxqugUlvHFkFiLnLR/bxk= +github.com/casbin/casbin/v2 v2.135.0/go.mod h1:FmcfntdXLTcYXv/hxgNntcRPqAbwOG9xsism0yXT+18= github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= github.com/casbin/govaluate v1.10.0 h1:ffGw51/hYH3w3rZcxO/KcaUIDOLP84w7nsidMVgaDG0= github.com/casbin/govaluate v1.10.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= diff --git a/api/server/interface/api/srequest/payment.go b/api/server/interface/api/srequest/payment.go index 0d4ff59..e9d4ed1 100644 --- a/api/server/interface/api/srequest/payment.go +++ b/api/server/interface/api/srequest/payment.go @@ -2,14 +2,14 @@ package srequest import orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1" -type QuotePaymentPayload struct { +type QuotePayment struct { IdempotencyKey string `json:"idempotencyKey"` Intent *orchestratorv1.PaymentIntent `json:"intent"` PreviewOnly bool `json:"previewOnly"` Metadata map[string]string `json:"metadata,omitempty"` } -type InitiatePaymentPayload struct { +type InitiatePayment struct { IdempotencyKey string `json:"idempotencyKey"` Intent *orchestratorv1.PaymentIntent `json:"intent"` Metadata map[string]string `json:"metadata,omitempty"` diff --git a/api/server/internal/server/ledgerapiimp/balance.go b/api/server/internal/server/ledgerapiimp/balance.go index 4bf05be..2a48590 100644 --- a/api/server/internal/server/ledgerapiimp/balance.go +++ b/api/server/internal/server/ledgerapiimp/balance.go @@ -10,6 +10,7 @@ import ( "github.com/tech/sendico/pkg/mservice" ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1" "github.com/tech/sendico/server/interface/api/sresponse" + mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/bson/primitive" "go.uber.org/zap" ) @@ -29,11 +30,11 @@ func (a *LedgerAPI) getBalance(r *http.Request, account *model.Account, token *s ctx := r.Context() res, err := a.enf.Enforce(ctx, a.balancePerm, account.ID, orgRef, primitive.NilObjectID, model.ActionRead) if err != nil { - a.logger.Warn("Failed to check ledger balance access permissions", zap.Error(err), zap.String(a.oph.Name(), orgRef.Hex()), zap.String("ledger_account_ref", accountRef)) + a.logger.Warn("Failed to check ledger balance access permissions", zap.Error(err), mutil.PLog(a.oph, r), zap.String("ledger_account_ref", accountRef)) return response.Auto(a.logger, a.Name(), err) } if !res { - a.logger.Debug("Access denied when reading ledger balance", zap.String(a.oph.Name(), orgRef.Hex()), zap.String("ledger_account_ref", accountRef)) + a.logger.Debug("Access denied when reading ledger balance", mutil.PLog(a.oph, r), zap.String("ledger_account_ref", accountRef)) return response.AccessDenied(a.logger, a.Name(), "ledger balance read permission denied") } if a.client == nil { diff --git a/api/server/internal/server/ledgerapiimp/list.go b/api/server/internal/server/ledgerapiimp/list.go index d10963a..2f2c628 100644 --- a/api/server/internal/server/ledgerapiimp/list.go +++ b/api/server/internal/server/ledgerapiimp/list.go @@ -9,6 +9,7 @@ import ( "github.com/tech/sendico/pkg/mservice" ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1" "github.com/tech/sendico/server/interface/api/sresponse" + mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/bson/primitive" "go.uber.org/zap" ) @@ -23,11 +24,11 @@ func (a *LedgerAPI) listAccounts(r *http.Request, account *model.Account, token ctx := r.Context() res, err := a.enf.Enforce(ctx, a.permissionRef, account.ID, orgRef, primitive.NilObjectID, model.ActionRead) if err != nil { - a.logger.Warn("Failed to check ledger accounts access permissions", zap.Error(err), zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Warn("Failed to check ledger accounts access permissions", zap.Error(err), mutil.PLog(a.oph, r)) return response.Auto(a.logger, a.Name(), err) } if !res { - a.logger.Debug("Access denied when listing ledger accounts", zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Debug("Access denied when listing ledger accounts", mutil.PLog(a.oph, r)) return response.AccessDenied(a.logger, a.Name(), "ledger accounts read permission denied") } if a.client == nil { diff --git a/api/server/internal/server/paymentapiimp/pay.go b/api/server/internal/server/paymentapiimp/pay.go index 9ac128a..44bf567 100644 --- a/api/server/internal/server/paymentapiimp/pay.go +++ b/api/server/internal/server/paymentapiimp/pay.go @@ -11,6 +11,7 @@ import ( orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1" "github.com/tech/sendico/server/interface/api/srequest" "github.com/tech/sendico/server/interface/api/sresponse" + mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/bson/primitive" "go.uber.org/zap" ) @@ -26,11 +27,11 @@ func (a *PaymentAPI) initiatePayment(r *http.Request, account *model.Account, to ctx := r.Context() allowed, err := a.enf.Enforce(ctx, a.permissionRef, account.ID, orgRef, primitive.NilObjectID, model.ActionCreate) if err != nil { - a.logger.Warn("Failed to check payments access permissions", zap.Error(err), zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Warn("Failed to check payments access permissions", zap.Error(err), mutil.PLog(a.oph, r)) return response.Auto(a.logger, a.Name(), err) } if !allowed { - a.logger.Debug("Access denied when initiating payment", zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Debug("Access denied when initiating payment", mutil.PLog(a.oph, r)) return response.AccessDenied(a.logger, a.Name(), "payments write permission denied") } @@ -66,10 +67,10 @@ func (a *PaymentAPI) initiatePayment(r *http.Request, account *model.Account, to return sresponse.PaymentResponse(a.logger, resp.GetPayment(), token) } -func decodeInitiatePayload(r *http.Request) (*srequest.InitiatePaymentPayload, error) { +func decodeInitiatePayload(r *http.Request) (*srequest.InitiatePayment, error) { defer r.Body.Close() - payload := &srequest.InitiatePaymentPayload{} + payload := &srequest.InitiatePayment{} if err := json.NewDecoder(r.Body).Decode(payload); err != nil { return nil, merrors.InvalidArgument("invalid payload: " + err.Error()) } diff --git a/api/server/internal/server/paymentapiimp/quote.go b/api/server/internal/server/paymentapiimp/quote.go index c14af3d..844bf9b 100644 --- a/api/server/internal/server/paymentapiimp/quote.go +++ b/api/server/internal/server/paymentapiimp/quote.go @@ -11,6 +11,7 @@ import ( orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1" "github.com/tech/sendico/server/interface/api/srequest" "github.com/tech/sendico/server/interface/api/sresponse" + mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/bson/primitive" "go.uber.org/zap" ) @@ -25,11 +26,11 @@ func (a *PaymentAPI) quotePayment(r *http.Request, account *model.Account, token ctx := r.Context() allowed, err := a.enf.Enforce(ctx, a.permissionRef, account.ID, orgRef, primitive.NilObjectID, model.ActionCreate) if err != nil { - a.logger.Warn("Failed to check payments access permissions", zap.Error(err), zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Warn("Failed to check payments access permissions", zap.Error(err), mutil.PLog(a.oph, r)) return response.Auto(a.logger, a.Name(), err) } if !allowed { - a.logger.Debug("Access denied when quoting payment", zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Debug("Access denied when quoting payment", mutil.PLog(a.oph, r)) return response.AccessDenied(a.logger, a.Name(), "payments write permission denied") } @@ -56,10 +57,10 @@ func (a *PaymentAPI) quotePayment(r *http.Request, account *model.Account, token return sresponse.PaymentQuoteResponse(a.logger, resp.GetQuote(), token) } -func decodeQuotePayload(r *http.Request) (*srequest.QuotePaymentPayload, error) { +func decodeQuotePayload(r *http.Request) (*srequest.QuotePayment, error) { defer r.Body.Close() - payload := &srequest.QuotePaymentPayload{} + payload := &srequest.QuotePayment{} if err := json.NewDecoder(r.Body).Decode(payload); err != nil { return nil, merrors.InvalidArgument("invalid payload: " + err.Error()) } diff --git a/api/server/internal/server/walletapiimp/balance.go b/api/server/internal/server/walletapiimp/balance.go index 55397ac..aeb05a8 100644 --- a/api/server/internal/server/walletapiimp/balance.go +++ b/api/server/internal/server/walletapiimp/balance.go @@ -10,6 +10,7 @@ import ( "github.com/tech/sendico/pkg/mservice" chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1" "github.com/tech/sendico/server/interface/api/sresponse" + mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/bson/primitive" "go.uber.org/zap" ) @@ -28,11 +29,11 @@ func (a *WalletAPI) getWalletBalance(r *http.Request, account *model.Account, to ctx := r.Context() res, err := a.enf.Enforce(ctx, a.balancesPermissionRef, account.ID, orgRef, primitive.NilObjectID, model.ActionRead) if err != nil { - a.logger.Warn("Failed to check wallet balance permissions", zap.Error(err), zap.String(a.oph.Name(), orgRef.Hex()), zap.String("wallet_ref", walletRef)) + a.logger.Warn("Failed to check wallet balance permissions", zap.Error(err), mutil.PLog(a.oph, r), zap.String("wallet_ref", walletRef)) return response.Auto(a.logger, a.Name(), err) } if !res { - a.logger.Debug("Access denied when reading wallet balance", zap.String(a.oph.Name(), orgRef.Hex()), zap.String("wallet_ref", walletRef)) + a.logger.Debug("Access denied when reading wallet balance", mutil.PLog(a.oph, r), zap.String("wallet_ref", walletRef)) return response.AccessDenied(a.logger, a.Name(), "wallet balance read permission denied") } if a.chainGateway == nil { diff --git a/api/server/internal/server/walletapiimp/list.go b/api/server/internal/server/walletapiimp/list.go index e8cb246..18aa62f 100644 --- a/api/server/internal/server/walletapiimp/list.go +++ b/api/server/internal/server/walletapiimp/list.go @@ -10,6 +10,7 @@ import ( "github.com/tech/sendico/pkg/mservice" chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1" "github.com/tech/sendico/server/interface/api/sresponse" + mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/bson/primitive" "go.uber.org/zap" ) @@ -24,11 +25,11 @@ func (a *WalletAPI) listWallets(r *http.Request, account *model.Account, token * ctx := r.Context() res, err := a.enf.Enforce(ctx, a.walletsPermissionRef, account.ID, orgRef, primitive.NilObjectID, model.ActionRead) if err != nil { - a.logger.Warn("Failed to check chain wallet access permissions", zap.Error(err), zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Warn("Failed to check chain wallet access permissions", zap.Error(err), mutil.PLog(a.oph, r)) return response.Auto(a.logger, a.Name(), err) } if !res { - a.logger.Debug("Access denied when listing organization wallets", zap.String(a.oph.Name(), orgRef.Hex())) + a.logger.Debug("Access denied when listing organization wallets", mutil.PLog(a.oph, r)) return response.AccessDenied(a.logger, a.Name(), "wallets read permission denied") } if a.chainGateway == nil {