Hello, I am totally new in Rust. I want to develop a function where payment method will be hidden based on cart attribute. I have done everything but in rust, I don’t know how to access cart attribute value.
Here is my input.Graphql
query Input {
cart {
payment_method: attribute(key: "payment_method") {
value
}
cost {
totalAmount {
amount
}
}
}
paymentMethods {
id
name
}
paymentCustomization {
metafield(namespace: "payment_customize", key: "function-configuration") {
value
}
}
}
This is this input which I got in app extenstion:
{
"cart": {
"payment_method": {
"value": "COD"
},
"cost": {
"totalAmount": {
"amount": "100.0"
}
}
},
"paymentMethods": [
{
"id": "gid://shopify/PaymentCustomizationPaymentMethod/0",
"name": "(for testing) Bogus Gateway"
},
{
"id": "gid://shopify/PaymentCustomizationPaymentMethod/1",
"name": "Cash on Delivery (COD)"
}
],
"paymentCustomization": {
"metafield": {
"value": "{\"paymentMethodName\":\"Cash on Delivery (COD)\",\"cartProperty\":\"COD\"}"
}
}
}
But In Rust, I was trying to access attribute value like this:
if input.cart.payment_method.value.to_string() == config.cart_property.to_string() {
return Ok(no_changes);
}
Can anyone help me with this ?
Thanks