Skip to content

Commit

Permalink
starting sitemap rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
djkato committed Jul 3, 2024
1 parent b8ae6fc commit c986b7f
Show file tree
Hide file tree
Showing 28 changed files with 522 additions and 37,178 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## COMMON VARIABLES FOR ALL APPS
REQUIRED_SALEOR_VERSION="^3.13"
# only sets port, the host is always 0.0.0.0 (listens to everything). Set this to docker-compose service name
APP_API_BASE_URL="http://10.100.110.21:3000"
APP_IFRAME_BASE_URL="http://10.100.110.21:3000"
APP_API_BASE_URL="http://10.100.110.27:3000"
APP_IFRAME_BASE_URL="http://10.100.110.27:3000"
APL="Redis"
APL_URL="redis://localhost:6380/2"
LOG_LEVEL="DEBUG"
Expand All @@ -28,3 +28,4 @@ ACTIVE_PAYMENT_METHODS="cod,cash,transfer"
LOCALE="Sk"
# uses https://crates.io/crates/iso_currency
CURRENCIES="EUR"
COD_EXTRA_PRICE_AS_PRODUCT_SLUG="dobierka"
File renamed without changes.
70 changes: 43 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ serde-wasm-bindgen = { version = "0.6.5", optional = true }
bus = { version = "2.4.1", optional = true }

[dependencies.web-sys]
optional = true
workspace = true
features = [
"Window",
Expand All @@ -74,4 +75,9 @@ middleware = [
redis_apl = ["dep:redis"]
webhook_utils = ["dep:http"]
tracing = ["dep:tracing", "dep:tracing-subscriber"]
bridge = ["dep:wasm-bindgen", "dep:bus", "dep:serde-wasm-bindgen"]
bridge = [
"dep:wasm-bindgen",
"dep:bus",
"dep:serde-wasm-bindgen",
"dep:web-sys",
]
1 change: 1 addition & 0 deletions simple-payment-gateway/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub struct AppState {
pub config: Config,
pub manifest: AppManifest,
pub active_payment_methods: Vec<ActivePaymentMethod>,
pub cod_extra_price_as_product_slug: Option<String>,
}

pub fn get_active_payment_methods_from_env() -> anyhow::Result<Vec<ActivePaymentMethod>> {
Expand Down
1 change: 1 addition & 0 deletions simple-payment-gateway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ async fn main() -> anyhow::Result<()> {
manifest: app_manifest,
config: config.clone(),
saleor_app: Arc::new(Mutex::new(saleor_app)),
cod_extra_price_as_product_slug: std::env::var("COD_EXTRA_PRICE_AS_PRODUCT_SLUG").ok()
};
let app = create_routes(app_state);

Expand Down
12 changes: 12 additions & 0 deletions simple-payment-gateway/src/routes/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ async fn create_response(
// .await?
// .token;

if payment_method == PaymentMethodType::COD {
match session_data.source_object {
OrderOrCheckout::Order(o) => {
o.collection_point_name;
}
OrderOrCheckout::Checkout(c) => {
c.delivery_method;
}
_ => error!("session_data.source_object is neither Order or Checkout")
}
}

let str_payment_method =
serde_json::to_string(&TransactionInitializeSessionData { payment_method })?;

Expand Down
11 changes: 3 additions & 8 deletions sitemap-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sitemap-generator"
version = "0.1.0"
version = "1.0.0"
edition = "2021"
authors = ["Djkáťo <djkatovfx@gmail.com>"]
description = "Creates and keeps Sitemap.xml uptodate with Saleor."
Expand All @@ -16,11 +16,6 @@ anyhow.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["full"] }
redis = { workspace = true, features = [
"aio",
"tokio-comp",
"connection-manager",
] }
envy.workspace = true
tracing.workspace = true
tracing-serde.workspace = true
Expand All @@ -35,13 +30,13 @@ cynic = { workspace = true, features = ["http-surf"] }
cynic-codegen.workspace = true
tera = { version = "1.19.1", default-features = false }
fd-lock = "4.0.2"
quick-xml = { version = "0.31.0", features = ["serialize"] }
quick-xml = { version = "0.34.0", features = ["serialize"] }
flate2 = "1.0.28"
tinytemplate = "1.2.1"
sitemap-rs = "0.2.1"
chrono = { version = "0.4.34", features = ["serde"] }
serde_cbor = "0.11.2"
pico-args = "0.5.0"
rayon = "1.10.0"

[build-dependencies]
cynic-codegen.workspace = true
2 changes: 1 addition & 1 deletion sitemap-generator/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
cynic_codegen::register_schema("saleor")
.from_sdl_file("schema/schema.graphql")
.from_sdl_file("../schema.graphql")
.unwrap()
.as_default()
.unwrap();
Expand Down
14 changes: 14 additions & 0 deletions sitemap-generator/public/schemas/saleor-ref.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- change the target namespace for your app I think? Not sure -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://app-sitemap-generator.kremik.sk/schemas/saleor-ref.xsd">

<xs:element name="ref">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:string"/>
<xs:element name="category-id" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>
5 changes: 5 additions & 0 deletions sitemap-generator/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "nightly-2024-06-20"
## Toggle to this one for sdk releases
# channel = "stable"
targets = ["x86_64-unknown-linux-gnu"]
Loading

0 comments on commit c986b7f

Please sign in to comment.