Merge
This commit is contained in:
commit
d3b5e85427
5043
Cargo.lock
generated
5043
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
64
Cargo.toml
64
Cargo.toml
@ -2,23 +2,22 @@
|
|||||||
members = [
|
members = [
|
||||||
# shared
|
# shared
|
||||||
"crates/model",
|
"crates/model",
|
||||||
"crates/channels",
|
# "crates/channels",
|
||||||
"crates/config",
|
"crates/config",
|
||||||
"crates/testx",
|
"crates/testx",
|
||||||
"crates/db-utils",
|
"crates/db-utils",
|
||||||
# actors
|
# actors
|
||||||
"crates/account_manager",
|
# "crates/account_manager",
|
||||||
"crates/cart_manager",
|
# "crates/cart_manager",
|
||||||
# "crates/database_manager",
|
# "crates/database_manager",
|
||||||
"crates/email_manager",
|
# "crates/email_manager",
|
||||||
"crates/order_manager",
|
# "crates/order_manager",
|
||||||
"crates/payment_manager",
|
# "crates/payment_manager",
|
||||||
"crates/search_manager",
|
# "crates/search_manager",
|
||||||
"crates/stock_manager",
|
# "crates/stock_manager",
|
||||||
"crates/token_manager",
|
# "crates/token_manager",
|
||||||
# "crates/fs_manager",
|
# "crates/fs_manager",
|
||||||
"crates/lang_provider",
|
# "crates/lang_provider",
|
||||||
"crates/fulfillment_adapter",
|
|
||||||
# "crates/payment_adapter_pay_u",
|
# "crates/payment_adapter_pay_u",
|
||||||
# artifacts
|
# artifacts
|
||||||
# "crates/db-seed",
|
# "crates/db-seed",
|
||||||
@ -27,6 +26,7 @@ members = [
|
|||||||
# vendor
|
# vendor
|
||||||
# "vendor/t_pay",
|
# "vendor/t_pay",
|
||||||
# "vendor/pay_u",
|
# "vendor/pay_u",
|
||||||
|
"crates/fulfillment_adapter",
|
||||||
# PLUGINS
|
# PLUGINS
|
||||||
"crates/telemetry-plugin",
|
"crates/telemetry-plugin",
|
||||||
"crates/plugin-api",
|
"crates/plugin-api",
|
||||||
@ -50,11 +50,12 @@ members = [
|
|||||||
"migration",
|
"migration",
|
||||||
|
|
||||||
###### TEST
|
###### TEST
|
||||||
"crates/web-api-plugin-tester",
|
# "crates/web-api-plugin-tester",
|
||||||
]
|
]
|
||||||
exclude = [
|
exclude = [
|
||||||
"crates/web"
|
"crates/web"
|
||||||
]
|
]
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
plugin-api = { path = "crates/plugin-api" }
|
plugin-api = { path = "crates/plugin-api" }
|
||||||
@ -62,6 +63,45 @@ payment-adapter = { path = "crates/payment-adapter" }
|
|||||||
event-bus-adapter = { path = "crates/event-bus-adapter" }
|
event-bus-adapter = { path = "crates/event-bus-adapter" }
|
||||||
cache-adapter = { path = "crates/cache-adapter" }
|
cache-adapter = { path = "crates/cache-adapter" }
|
||||||
file-storage-adapter = { path = "crates/file-storage-adapter" }
|
file-storage-adapter = { path = "crates/file-storage-adapter" }
|
||||||
|
actix-web = "4.3.1"
|
||||||
|
argon2 = "0"
|
||||||
|
async-std = "1"
|
||||||
|
async-stripe = "0.21.0"
|
||||||
|
async-trait = "0.1.68"
|
||||||
|
bincode = "1.3.3"
|
||||||
|
clap = "3.2.25"
|
||||||
|
common_macros = "0"
|
||||||
|
cookie = "0"
|
||||||
|
deadpool = "0.9.5"
|
||||||
|
dotenv = "0.15.0"
|
||||||
|
email_address = "0.2.4"
|
||||||
|
fake = "2"
|
||||||
|
futures-executor = "0.3.28"
|
||||||
|
futures-util = "0.3.28"
|
||||||
|
insta = "1.29.0"
|
||||||
|
opentelemetry = "0.19.0"
|
||||||
|
opentelemetry-otlp = "0.12.0"
|
||||||
|
opentelemetry-semantic-conventions = "0.11.0"
|
||||||
|
parking_lot = "0"
|
||||||
|
password-hash = "=0.4.2"
|
||||||
|
rand = "0"
|
||||||
|
rand_core = "0"
|
||||||
|
redis = "=0.23.0"
|
||||||
|
redis-async = "=0.16.0"
|
||||||
|
redis-async-pool = { git = "https://github.com/Eraden/redis-async-pool.git", branch = "upgrade-dependencies" }
|
||||||
|
rust-s3 = "=0.33.0"
|
||||||
|
sea-orm-migration = "0.11.0"
|
||||||
|
serde = "1.0.164"
|
||||||
|
serde_json = "1.0.96"
|
||||||
|
sqlx-core = "0"
|
||||||
|
thiserror = "1.0.40"
|
||||||
|
tokio = "1.28.2"
|
||||||
|
tracing-bunyan-formatter = "0.3.7"
|
||||||
|
tracing-opentelemetry = "0.19.0"
|
||||||
|
tracing-timing = "0"
|
||||||
|
traitcast = "0.5.0"
|
||||||
|
uuid = "1.3.4"
|
||||||
|
validator = "0.18.1"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
@ -4,10 +4,10 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
bincode = { version = "1" }
|
bincode = { workspace = true }
|
||||||
config = { path = "../config" }
|
config = { path = "../config" }
|
||||||
serde = { version = "1.0.163", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
toml = { version = "0.7.3" }
|
toml = { version = "0.7.3" }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
|
@ -8,12 +8,12 @@ crate-type = ["cdylib"]
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
bincode = { version = "1" }
|
bincode = { workspace = true }
|
||||||
cache-adapter = { path = "../cache-adapter" }
|
cache-adapter = { path = "../cache-adapter" }
|
||||||
chrono = { version = "0.4.26" }
|
chrono = { version = "0.4.26" }
|
||||||
futures-executor = { version = "0.3.28", features = [] }
|
futures-executor = { workspace = true, features = [] }
|
||||||
plugin-api = { workspace = true }
|
plugin-api = { workspace = true }
|
||||||
serde = { version = "1.0.163", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
tokio = { version = "1.28.2", features = ['full'] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
|
@ -8,14 +8,14 @@ crate-type = ["cdylib"]
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
bincode = { version = "1" }
|
bincode = { workspace = true }
|
||||||
cache-adapter = { path = "../cache-adapter" }
|
cache-adapter = { path = "../cache-adapter" }
|
||||||
chrono = { version = "0.4.26" }
|
chrono = { version = "0.4.26" }
|
||||||
deadpool = { version = "0.9.5" }
|
deadpool = { workspace = true }
|
||||||
futures = { version = "0.3.28" }
|
futures = { version = "0.3.28" }
|
||||||
redis = { version = "0.23.0" }
|
redis = { workspace = true }
|
||||||
redis-async-pool = { git = "https://github.com/Eraden/redis-async-pool.git", branch = "upgrade-dependencies" }
|
redis-async-pool = { workspace = true }
|
||||||
serde = { version = "1.0.163", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
tokio = { version = "1.28.2", features = ['full'] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
|
@ -8,13 +8,13 @@ full = ['actix-web', 'cookie']
|
|||||||
default = []
|
default = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { version = "4", features = [], optional = true }
|
actix-web = { workspace = true, features = [], optional = true }
|
||||||
cookie = { version = "0", features = ["signed"], optional = true }
|
cookie = { workspace = true, features = ["signed"], optional = true }
|
||||||
parking_lot = { version = "0", features = [] }
|
parking_lot = { workspace = true, features = [] }
|
||||||
password-hash = { version = "=0.4.2", features = ["alloc"] }
|
password-hash = { workspace = true, features = ["alloc"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { version = "1", features = [] }
|
serde_json = { workspace = true, features = [] }
|
||||||
thiserror = { version = "1" }
|
thiserror = { workspace = true }
|
||||||
toml = { version = "0", features = [] }
|
toml = { version = "0", features = [] }
|
||||||
tracing-subscriber = { version = "0", features = ['env-filter'] }
|
tracing-subscriber = { version = "0", features = ['env-filter'] }
|
||||||
tracing-timing = { version = "0", features = [] }
|
tracing-timing = { workspace = true, features = [] }
|
||||||
|
@ -6,4 +6,4 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
model = { path = "../model", features = ["db"] }
|
model = { path = "../model", features = ["db"] }
|
||||||
sqlx = { version = "0", features = ["migrate", "runtime-actix-rustls", "all-types", "postgres"] }
|
sqlx = { version = "0", features = ["migrate", "runtime-actix-rustls", "all-types", "postgres"] }
|
||||||
sqlx-core = { version = "0", features = [] }
|
sqlx-core = { workspace = true, features = [] }
|
||||||
|
@ -4,13 +4,13 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = { version = "1.3.3" }
|
bincode = { workspace = true }
|
||||||
config = { path = "../config" }
|
config = { path = "../config" }
|
||||||
event-bus-messages = { path = "../event-bus-messages" }
|
event-bus-messages = { path = "../event-bus-messages" }
|
||||||
futures = { version = "0.3.28" }
|
futures = { version = "0.3.28" }
|
||||||
serde = { version = "1.0.162", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
toml = { version = "0.7.3" }
|
toml = { version = "0.7.3" }
|
||||||
uuid = { version = "1.3.3", features = ['v4'] }
|
uuid = { workspace = true, features = ["v4"] }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
tokio = { version = "1.28.2", features = ['full'] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = { version = "1.3.3" }
|
bincode = { workspace = true }
|
||||||
serde = { version = "1.0.162", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { version = "1.0.96" }
|
serde_json = { workspace = true }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
|
@ -11,10 +11,10 @@ path = "src/lib.rs"
|
|||||||
event-bus-adapter = { workspace = true }
|
event-bus-adapter = { workspace = true }
|
||||||
plugin-api = { workspace = true }
|
plugin-api = { workspace = true }
|
||||||
futures = { version = "0.3.28" }
|
futures = { version = "0.3.28" }
|
||||||
futures-util = { version = "0.3.28" }
|
futures-util = { workspace = true }
|
||||||
redis-async = { version = "0.16.0" }
|
redis-async = { workspace = true }
|
||||||
serde = { version = "1.0.162" }
|
serde = { workspace = true }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
toml = { version = "0.7.4" }
|
toml = { version = "0.7.4" }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
|
@ -4,9 +4,9 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
config = { path = "../config" }
|
config = { path = "../config" }
|
||||||
futures = { version = "0.3.28", features = ["async-await", 'io-compat'] }
|
futures = { version = "0.3.28", features = ["async-await", 'io-compat'] }
|
||||||
futures-util = { version = "0.3.28" }
|
futures-util = { workspace = true }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
|
@ -8,10 +8,10 @@ crate-type = ["cdylib"]
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
file-storage-adapter = { path = "../file-storage-adapter" }
|
file-storage-adapter = { path = "../file-storage-adapter" }
|
||||||
futures = { version = "0.3.28" }
|
futures = { version = "0.3.28" }
|
||||||
serde = { version = "1.0.163", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
tokio = { version = "1.28.2", features = ['full'] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
tracing = { version = "0.1" }
|
tracing = { version = "0.1" }
|
||||||
uuid = { version = "1.3.3", features = ['v4'] }
|
uuid = { workspace = true, features = ["v4"] }
|
||||||
|
@ -10,9 +10,9 @@ path = "src/lib.rs"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
file-storage-adapter = { workspace = true }
|
file-storage-adapter = { workspace = true }
|
||||||
futures = { version = "0.3.28" }
|
futures = { version = "0.3.28" }
|
||||||
rust-s3 = { version = "0.33.0", features = ['with-tokio'] }
|
rust-s3 = { workspace = true, features = ["with-tokio"] }
|
||||||
serde = { version = "1.0.163", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
tokio = { version = "1.28.2" }
|
tokio = { workspace = true }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
uuid = { version = "1.3.4", features = ['v4'] }
|
uuid = { workspace = true, features = ["v4"] }
|
||||||
|
@ -3,7 +3,7 @@ use std::str::FromStr;
|
|||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use file_storage_adapter::{Error, PluginConfig, SResult, Url};
|
use file_storage_adapter::{Error, PluginConfig, SResult, Url};
|
||||||
use futures::{AsyncRead, TryFutureExt};
|
use futures::{AsyncRead, AsyncReadExt, TryFutureExt};
|
||||||
use s3::creds::Credentials;
|
use s3::creds::Credentials;
|
||||||
use s3::{Bucket, Region};
|
use s3::{Bucket, Region};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -77,15 +77,21 @@ impl file_storage_adapter::FileStorage for S3FileStorage {
|
|||||||
path = path.join(prefix);
|
path = path.join(prefix);
|
||||||
};
|
};
|
||||||
path = path.join(name);
|
path = path.join(name);
|
||||||
|
let mut bytes = Vec::new();
|
||||||
|
file.read_to_end(&mut bytes).await.map_err(|e| {
|
||||||
|
error!("Failed to upload file to s3: {e}");
|
||||||
|
Error::SaveExternal
|
||||||
|
})?;
|
||||||
|
|
||||||
let status_code: u16 = self
|
let res = self
|
||||||
.bucket
|
.bucket
|
||||||
.put_object_stream(file.as_mut(), &path)
|
.put_object(&path.display().to_string(), bytes.as_slice())
|
||||||
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("Failed to upload file to s3: {e}");
|
error!("Failed to upload file to s3: {e}");
|
||||||
Error::Save
|
Error::SaveExternal
|
||||||
})
|
})?;
|
||||||
.await?;
|
let status_code: u16 = res.status_code();
|
||||||
|
|
||||||
if status_code >= 300 {
|
if status_code >= 300 {
|
||||||
Err(Error::SaveExternal)
|
Err(Error::SaveExternal)
|
||||||
|
@ -4,6 +4,6 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
|
@ -17,17 +17,18 @@ payments = []
|
|||||||
default = ['accounts', 'carts', 'emails', 'search', 'stocks', 'orders', 'payments']
|
default = ['accounts', 'carts', 'emails', 'search', 'stocks', 'orders', 'payments']
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
argon2 = { version = "0", features = ["parallel", "password-hash"] }
|
argon2 = { workspace = true, features = ["parallel", "password-hash"] }
|
||||||
chrono = { version = "0", features = ["serde"] }
|
chrono = { version = "0", features = ["serde"] }
|
||||||
derive_more = { version = "0" }
|
derive_more = { version = "0" }
|
||||||
fake = { version = "2", features = ["derive", "chrono", "http", "uuid", "dummy"], optional = true }
|
email_address = { workspace = true }
|
||||||
password-hash = { version = "=0.4.2", features = ["alloc"] }
|
fake = { workspace = true, features = ["derive", "chrono", "http", "uuid", "dummy"], optional = true }
|
||||||
rand = { version = "0", optional = true }
|
password-hash = { workspace = true, features = ["alloc"] }
|
||||||
rand_core = { version = "0", features = ["std"] }
|
rand = { workspace = true, optional = true }
|
||||||
serde = { version = "1" }
|
rand_core = { workspace = true, features = ["std"] }
|
||||||
|
serde = { workspace = true }
|
||||||
sqlx = { version = "0", features = ["migrate", "runtime-actix-rustls", "all-types", "postgres"], optional = true }
|
sqlx = { version = "0", features = ["migrate", "runtime-actix-rustls", "all-types", "postgres"], optional = true }
|
||||||
sqlx-core = { version = "0", features = [], optional = true }
|
sqlx-core = { workspace = true, features = [], optional = true }
|
||||||
thiserror = { version = "1" }
|
thiserror = { workspace = true }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
uuid = { version = "1", features = ["serde"] }
|
uuid = { workspace = true, features = ["serde"] }
|
||||||
validator = { version = "0" }
|
validator = { workspace = true }
|
||||||
|
@ -107,6 +107,7 @@ pub struct Orders(pub Vec<Order>);
|
|||||||
|
|
||||||
impl From<(Vec<crate::Order>, Vec<crate::OrderItem>)> for Orders {
|
impl From<(Vec<crate::Order>, Vec<crate::OrderItem>)> for Orders {
|
||||||
fn from((orders, mut items): (Vec<crate::Order>, Vec<crate::OrderItem>)) -> Self {
|
fn from((orders, mut items): (Vec<crate::Order>, Vec<crate::OrderItem>)) -> Self {
|
||||||
|
// let items = items.drain(..);
|
||||||
Self(
|
Self(
|
||||||
orders
|
orders
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -120,11 +121,12 @@ impl From<(Vec<crate::Order>, Vec<crate::OrderItem>)> for Orders {
|
|||||||
checkout_notes,
|
checkout_notes,
|
||||||
address_id,
|
address_id,
|
||||||
}| {
|
}| {
|
||||||
|
let items = items.drain(..);
|
||||||
Order {
|
Order {
|
||||||
id,
|
id,
|
||||||
buyer_id,
|
buyer_id,
|
||||||
status,
|
status,
|
||||||
items: items.drain_filter(|item| item.order_id == id).collect(),
|
items: items.filter(|item| item.order_id == id).collect(),
|
||||||
checkout_notes,
|
checkout_notes,
|
||||||
address_id,
|
address_id,
|
||||||
}
|
}
|
||||||
@ -154,7 +156,10 @@ impl From<(crate::Order, Vec<crate::OrderItem>)> for Order {
|
|||||||
id,
|
id,
|
||||||
buyer_id,
|
buyer_id,
|
||||||
status,
|
status,
|
||||||
items: items.drain_filter(|item| item.order_id == id).collect(),
|
items: items
|
||||||
|
.into_iter()
|
||||||
|
.filter(|item| item.order_id == id)
|
||||||
|
.collect(),
|
||||||
checkout_notes,
|
checkout_notes,
|
||||||
address_id,
|
address_id,
|
||||||
}
|
}
|
||||||
@ -328,6 +333,8 @@ impl<'path>
|
|||||||
.map(|stock| (**stock.quantity > 0, stock.quantity_unit))
|
.map(|stock| (**stock.quantity > 0, stock.quantity_unit))
|
||||||
.unwrap_or_else(|| (false, QuantityUnit::Piece));
|
.unwrap_or_else(|| (false, QuantityUnit::Piece));
|
||||||
|
|
||||||
|
let photos_d = photos.drain(..);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
@ -339,8 +346,8 @@ impl<'path>
|
|||||||
available,
|
available,
|
||||||
quantity_unit,
|
quantity_unit,
|
||||||
deliver_days_flag,
|
deliver_days_flag,
|
||||||
photos: photos
|
photos: photos_d
|
||||||
.drain_filter(|photo| photo.product_id == id)
|
.filter(|photo| photo.product_id == id)
|
||||||
.map(
|
.map(
|
||||||
|ProductLinkedPhoto {
|
|ProductLinkedPhoto {
|
||||||
photo_id: id,
|
photo_id: id,
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![feature(drain_filter)]
|
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
|
|
||||||
pub mod encrypt;
|
pub mod encrypt;
|
||||||
@ -426,7 +424,7 @@ impl FromStr for Email {
|
|||||||
type Err = TransformError;
|
type Err = TransformError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
if validator::validate_email(s) {
|
if ::email_address::EmailAddress::is_valid(s) {
|
||||||
Ok(Self(String::from(s)))
|
Ok(Self(String::from(s)))
|
||||||
} else {
|
} else {
|
||||||
Err(TransformError::NotEmail)
|
Err(TransformError::NotEmail)
|
||||||
@ -451,7 +449,7 @@ impl<'de> serde::Deserialize<'de> for Email {
|
|||||||
where
|
where
|
||||||
E: Error,
|
E: Error,
|
||||||
{
|
{
|
||||||
if validator::validate_email(s) {
|
if ::email_address::EmailAddress::is_valid(s) {
|
||||||
Ok(String::from(s))
|
Ok(String::from(s))
|
||||||
} else {
|
} else {
|
||||||
Err(E::custom("this is not email address"))
|
Err(E::custom("this is not email address"))
|
||||||
|
@ -4,15 +4,15 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { version = "4.3.1" }
|
actix-web = { workspace = true }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
chrono = { version = "0.4.24" }
|
chrono = { version = "0.4.24" }
|
||||||
config = { path = "../config", default-features = false, features = [] }
|
config = { path = "../config", default-features = false, features = [] }
|
||||||
futures = { version = "0" }
|
futures = { version = "0" }
|
||||||
model = { path = "../model" }
|
model = { path = "../model" }
|
||||||
serde = { version = "1", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
thiserror = { version = "1" }
|
thiserror = { workspace = true }
|
||||||
toml = { version = "0.7.3" }
|
toml = { version = "0.7.3" }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
traitcast = { version = "0.5.0" }
|
traitcast = { workspace = true }
|
||||||
uuid = { version = "1", features = ['v4'] }
|
uuid = { workspace = true, features = ["v4"] }
|
||||||
|
@ -10,13 +10,13 @@ crate-type = ['dylib']
|
|||||||
#rustflags = ["-C", "prefer-dynamic", "-C", "rpath"]
|
#rustflags = ["-C", "prefer-dynamic", "-C", "rpath"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
bincode = { version = "1" }
|
bincode = { workspace = true }
|
||||||
chrono = { version = "0", features = ['alloc', 'wasmbind'] }
|
chrono = { version = "0", features = ['alloc', 'wasmbind'] }
|
||||||
common_macros = { version = "0" }
|
common_macros = { workspace = true }
|
||||||
fulfillment_adapter = { path = "../fulfillment_adapter" }
|
fulfillment_adapter = { path = "../fulfillment_adapter" }
|
||||||
payment-adapter = { path = "../payment-adapter" }
|
payment-adapter = { path = "../payment-adapter" }
|
||||||
serde = { version = "1", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { version = "1" }
|
serde_json = { workspace = true }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
|
@ -7,14 +7,14 @@ edition = "2021"
|
|||||||
crate-type = ['dylib']
|
crate-type = ['dylib']
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { version = "4.3.1" }
|
actix-web = { workspace = true }
|
||||||
async-stripe = { version = "0.21.0", features = ['tokio', 'async', 'runtime-tokio-hyper'] }
|
async-stripe = { workspace = true, features = ["tokio", "async", "runtime-tokio-hyper"] }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
derive_more = { version = "0.99.17" }
|
derive_more = { version = "0.99.17" }
|
||||||
fulfillment_adapter = { path = "../fulfillment_adapter" }
|
fulfillment_adapter = { path = "../fulfillment_adapter" }
|
||||||
payment-adapter = { path = "../payment-adapter" }
|
payment-adapter = { path = "../payment-adapter" }
|
||||||
plugin-api = { workspace = true }
|
plugin-api = { workspace = true }
|
||||||
serde = { version = "1.0.162", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
thiserror = { version = "1.0.40" }
|
thiserror = { workspace = true }
|
||||||
tokio = { version = "1.27.0" }
|
tokio = { workspace = true }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
|
@ -14,6 +14,8 @@ pub enum HookError {
|
|||||||
InvalidPayload,
|
InvalidPayload,
|
||||||
#[error("Stripe plugin is inactive")]
|
#[error("Stripe plugin is inactive")]
|
||||||
NoStripePlugin,
|
NoStripePlugin,
|
||||||
|
#[error("Failed to capture payment")]
|
||||||
|
CaptureFailed,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::post("/stripe/hooks")]
|
#[actix_web::post("/stripe/hooks")]
|
||||||
@ -208,8 +210,15 @@ async fn payment_intent_requires_capture(
|
|||||||
|
|
||||||
let mut intent: Box<dyn payment_adapter::PaymentSessionData + 'static> =
|
let mut intent: Box<dyn payment_adapter::PaymentSessionData + 'static> =
|
||||||
Box::new(Intent::new(intent));
|
Box::new(Intent::new(intent));
|
||||||
method.adapter.as_ref().capture_payment(&mut intent).await;
|
method
|
||||||
Ok(())
|
.adapter
|
||||||
|
.as_ref()
|
||||||
|
.capture_payment(&mut intent)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
tracing::error!("Payment capture failed: {e}");
|
||||||
|
HookError::CaptureFailed
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn payment_intent_requires_action(
|
async fn payment_intent_requires_action(
|
||||||
|
@ -4,9 +4,9 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { version = "4.3.1" }
|
actix-web = { workspace = true }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
bincode = { version = "1.3.3" }
|
bincode = { workspace = true }
|
||||||
cache-adapter = { workspace = true }
|
cache-adapter = { workspace = true }
|
||||||
config = { path = "../config", default-features = false, features = [] }
|
config = { path = "../config", default-features = false, features = [] }
|
||||||
derive_more = { version = "0.99.17" }
|
derive_more = { version = "0.99.17" }
|
||||||
@ -14,6 +14,6 @@ event-bus-adapter = { workspace = true }
|
|||||||
file-storage-adapter = { workspace = true }
|
file-storage-adapter = { workspace = true }
|
||||||
futures = { version = "0.3.28" }
|
futures = { version = "0.3.28" }
|
||||||
payment-adapter = { workspace = true }
|
payment-adapter = { workspace = true }
|
||||||
serde = { version = "1.0.163" }
|
serde = { workspace = true }
|
||||||
thiserror = { version = "1" }
|
thiserror = { workspace = true }
|
||||||
tracing = { version = "0" }
|
tracing = { version = "0" }
|
||||||
|
@ -31,14 +31,25 @@ pub trait Plugin: Any {
|
|||||||
where
|
where
|
||||||
Self: Sized;
|
Self: Sized;
|
||||||
|
|
||||||
|
/// Called after plugin is created
|
||||||
|
fn before_plugins_mount(&mut self) {}
|
||||||
|
|
||||||
|
/// Called after plugin is created
|
||||||
|
fn after_plugins_mount(&mut self) {}
|
||||||
|
|
||||||
|
/// Called after plugin is created to configure plugin
|
||||||
fn mount(&self, _config: &mut actix_web::web::ServiceConfig) {}
|
fn mount(&self, _config: &mut actix_web::web::ServiceConfig) {}
|
||||||
|
|
||||||
|
/// Adds payment method like PayPal, PayPro or Cash
|
||||||
async fn register_payment_methods(&mut self, _methods: &'static mut PaymentMethodRegister) {}
|
async fn register_payment_methods(&mut self, _methods: &'static mut PaymentMethodRegister) {}
|
||||||
|
|
||||||
|
/// Adds new event bus implementation like Redis, Kafka or rumqqt
|
||||||
async fn register_event_bus(&mut self, _register: &'static mut EventBusRegister) {}
|
async fn register_event_bus(&mut self, _register: &'static mut EventBusRegister) {}
|
||||||
|
|
||||||
|
/// Adds new cache method like Redis, Memcached or Memory
|
||||||
async fn register_cache(&mut self, _cache: &'static mut Cache) {}
|
async fn register_cache(&mut self, _cache: &'static mut Cache) {}
|
||||||
|
|
||||||
|
/// Adds new Files storage like Local FS or S3
|
||||||
async fn register_file_storage(&mut self, _register: &'static mut FileStorageRegister) {}
|
async fn register_file_storage(&mut self, _register: &'static mut FileStorageRegister) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,10 +183,12 @@ impl EventBusRegister {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn emit(&mut self, adapter_name: &str) {
|
pub fn emit(&mut self, adapter_name: &str) {
|
||||||
let Some(_adapter) = self.names
|
let Some(_adapter) = self
|
||||||
|
.names
|
||||||
.iter()
|
.iter()
|
||||||
.position(|n| *n == adapter_name)
|
.position(|n| *n == adapter_name)
|
||||||
.and_then(|pos| self.adapters.get(pos)) else {
|
.and_then(|pos| self.adapters.get(pos))
|
||||||
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
// adapter.
|
// adapter.
|
||||||
|
@ -7,14 +7,14 @@ edition = "2021"
|
|||||||
crate-type = ['dylib']
|
crate-type = ['dylib']
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
opentelemetry-otlp = { version = "0.12.0", features = ['trace', 'serde', 'reqwest', 'opentelemetry-http', 'metrics', 'grpc-tonic', 'reqwest-client'] }
|
opentelemetry-otlp = { workspace = true, features = ["trace", "serde", "reqwest", "opentelemetry-http", "metrics", "grpc-tonic", "reqwest-client"] }
|
||||||
opentelemetry = { version = "0.19.0", features = ['default', 'trace', 'metrics', 'rt-tokio'] }
|
opentelemetry = { workspace = true, features = ["default", "trace", "metrics", "rt-tokio"] }
|
||||||
tokio = { version = "1.28.2", features = ['full'] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
plugin-api = { workspace = true }
|
plugin-api = { workspace = true }
|
||||||
tracing-bunyan-formatter = { version = "0.3.7" }
|
tracing-bunyan-formatter = { workspace = true }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
serde = { version = "1.0.164", features = ['derive'] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
opentelemetry-semantic-conventions = { version = "0.11.0" }
|
opentelemetry-semantic-conventions = { workspace = true }
|
||||||
tracing-opentelemetry = { version = "0.19.0", features = ['async-trait', 'metrics'] }
|
tracing-opentelemetry = { workspace = true, features = ["async-trait", "metrics"] }
|
||||||
tracing-subscriber = { version = "0.3.17", features = ['env-filter'] }
|
tracing-subscriber = { version = "0.3.17", features = ['env-filter'] }
|
||||||
|
@ -5,7 +5,6 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
plugin-api = { path = "../plugin-api" }
|
plugin-api = { path = "../plugin-api" }
|
||||||
telemetry-plugin = { path = "../telemetry-plugin" }
|
|
||||||
actix = { version = "0.13.0" }
|
actix = { version = "0.13.0" }
|
||||||
actix-web = { version = "4.3.1" }
|
actix-web = { version = "4.3.1" }
|
||||||
actix-rt = { version = "2.8.0" }
|
actix-rt = { version = "2.8.0" }
|
||||||
|
@ -9,20 +9,14 @@ name = "migration"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
async-std = { workspace = true, features = ["attributes", "tokio1"] }
|
||||||
clap = { version = "3.2.25", features = ['derive'] }
|
clap = { workspace = true, features = ["derive"] }
|
||||||
tracing = { version = "0.1.37" }
|
tracing = { version = "0.1.37" }
|
||||||
tracing-subscriber = { version = "0.3.17", features = ['env-filter'] }
|
tracing-subscriber = { version = "0.3.17", features = ['env-filter'] }
|
||||||
dotenv = { version = "0.15.0" }
|
dotenv = { workspace = true }
|
||||||
async-trait = { version = "0.1.68" }
|
async-trait = { workspace = true }
|
||||||
|
sea-orm-migration ={ workspace = true, features = ["sqlx-postgres", "runtime-tokio-rustls"] }
|
||||||
[dependencies.sea-orm-migration]
|
|
||||||
version = "0.11.0"
|
|
||||||
features = [
|
|
||||||
"sqlx-postgres",
|
|
||||||
'runtime-tokio-rustls'
|
|
||||||
]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = { version = "1.29.0", features = ['ron'] }
|
insta = { workspace = true, features = ["ron"] }
|
||||||
sqlx = { version = "0.6.3", features = ['runtime-tokio-rustls'] }
|
sqlx = { version = "0.6.3", features = ['runtime-tokio-rustls'] }
|
||||||
|
Loading…
Reference in New Issue
Block a user