From b739488bfdcded21dcc589644ebe058f40cd8cf2 Mon Sep 17 00:00:00 2001 From: Denilson Velasquez <66847768+DeeTheDev@users.noreply.github.com> Date: Thu, 16 Nov 2023 23:43:38 -0500 Subject: [PATCH] Second team review requested changes - Fix incorrect discount/subsidy context in FoodDetail - FooDetail, move vendor below the divider line - Fix showing of the available credit on the FoodCart page - apply the subsidy for the subtotal (show $10 instead of $90) - ensure the offering can be paid at checkout without problems - Fulfillment options have link to address in google maps - "checkout whats available" typo, -> "what's" - FoodDetail, change order of discount and subsidy credit context --- lib/suma/api/commerce.rb | 6 ++++++ webapp/public/locale/en/strings.json | 7 ++++--- webapp/public/locale/es/strings.json | 5 +++-- webapp/src/components/FoodPrice.jsx | 5 ++++- webapp/src/pages/FoodCart.jsx | 17 ++++++++++++----- webapp/src/pages/FoodCheckout.jsx | 18 ++++++++++++++++-- webapp/src/pages/FoodDetails.jsx | 11 ++++++++--- 7 files changed, 53 insertions(+), 16 deletions(-) diff --git a/lib/suma/api/commerce.rb b/lib/suma/api/commerce.rb index 0913f5b3..eb0ab072 100644 --- a/lib/suma/api/commerce.rb +++ b/lib/suma/api/commerce.rb @@ -310,9 +310,15 @@ class OfferingWithContextEntity < BaseEntity end end + class FulfillmentOptionAddressEntity < BaseEntity + expose :one_line_address, &self.delegate_to(:one_line_address) + end + class FulfillmentOptionEntity < BaseEntity + include Suma::API::Entities expose :id expose_translated :description + expose :address, with: FulfillmentOptionAddressEntity end class CheckoutProductEntity < OfferingProductEntity diff --git a/webapp/public/locale/en/strings.json b/webapp/public/locale/en/strings.json index 82e53644..ffb3a595 100644 --- a/webapp/public/locale/en/strings.json +++ b/webapp/public/locale/en/strings.json @@ -59,7 +59,7 @@ "success_intro": "Thank you for signing up, and welcome to the suma app!\n\nWe will update you on all future projects, money saving opportunities, and how to complete the app enrollment process. To learn more about suma, visit our website at $t(strings:common:mysuma_website_link), or check us out on our social media using the link below. Chat soon!" }, "dashboard": { - "check_available_for_purchase": "Check out whats available for purchase", + "check_available_for_purchase": "Check out what's available for purchase", "check_ongoing_trip": "You have an ongoing trip. Please make sure you end it when you are finished with your ride!", "check_ongoing_trip_button": "See My Trip", "claim_orders": "Your order is ready for pickup.", @@ -112,6 +112,7 @@ "food": { "add_card": "Add debit/credit card", "add_to_cart": "Add to cart", + "address": "Address", "available_offerings": "Available Offerings", "available_until": "Until", "button_press_warning": "Don't press this button until you are at the market", @@ -131,7 +132,7 @@ "continue_to_checkout": "Continue to Checkout", "current_offerings": "Current Offerings", "details_header": "Details", - "discount_applied": "{{discountAmount, sumaCurrency}} discount", + "discount_applied": "{{discountAmount, sumaCurrency}} discount from {{vendorName}}", "edit_quantities": "Edit quantities", "ending_in": "ending in {{last4}}", "from_vendor": "From {{vendorName}}", @@ -177,7 +178,7 @@ "save_payment": "Save for future orders", "shop": "Shop", "sold_out": "Sold out", - "subsidy_and_discount_applied": "{{subsidyAmount, sumaCurrency}} suma subsidy credit and {{discountAmount, sumaCurrency}} discount", + "subsidy_and_discount_applied": "{{discountAmount, sumaCurrency}} discount from {{vendorName}} and {{subsidyAmount, sumaCurrency}} suma subsidy credit", "subsidy_applied": "{{subsidyAmount, sumaCurrency}} suma subsidy credit", "subtotal_items": "Subtotal ({{totalItems}} items): **{{customerCost, sumaCurrency}}**", "terms_of_use_agreement": "By clicking \"place order\" you agree to suma's [Terms of Use](/terms-of-use__blank__).", diff --git a/webapp/public/locale/es/strings.json b/webapp/public/locale/es/strings.json index b2016650..cf334073 100644 --- a/webapp/public/locale/es/strings.json +++ b/webapp/public/locale/es/strings.json @@ -112,6 +112,7 @@ "food": { "add_card": "Añadir tarjeta de débito/crédito", "add_to_cart": "Añadir al carrito", + "address": "Dirección", "available_offerings": "Ofertas disponibles", "available_until": "Hasta", "button_press_warning": "No presione este botón hasta que esté en el mercado", @@ -131,7 +132,7 @@ "continue_to_checkout": "Continúe para finalizar", "current_offerings": "Ofertas presentes", "details_header": "Detalles", - "discount_applied": "{{amount, sumaCurrency}} descuento", + "discount_applied": "{{discountAmount, sumaCurrency}} descuento de {{vendorName}}", "edit_quantities": "Editar cantidades", "ending_in": "terminan en {{last4}}", "from_vendor": "De {{vendorName}}", @@ -177,7 +178,7 @@ "save_payment": "Guardar para pedidos futuros", "shop": "Comprar", "sold_out": "Todo vendido", - "subsidy_and_discount_applied": "{{subsidyAmount, sumaCurrency}} suma subsidio crédito y {{discountAmount, sumaCurrency}} descuento", + "subsidy_and_discount_applied": "{{discountAmount, sumaCurrency}} descuento de {{vendorName}} y {{subsidyAmount, sumaCurrency}} suma subsidio crédito", "subsidy_applied": "{{subsidyAmount, sumaCurrency}} suma subsidio crédito", "subtotal_items": "Subtotal ({{totalItems}} artículos): **{{customerCost, sumaCurrency}} **", "terms_of_use_agreement": "Al hacer clic en \"realizar pedido\" usted acepta los [Términos de uso](/terms-of-use__blank__) de suma.", diff --git a/webapp/src/components/FoodPrice.jsx b/webapp/src/components/FoodPrice.jsx index 7f44d177..11f7c304 100644 --- a/webapp/src/components/FoodPrice.jsx +++ b/webapp/src/components/FoodPrice.jsx @@ -10,6 +10,7 @@ export default function FoodPrice({ discountAmount, displayableNoncashLedgerContributionAmount, displayableCashPrice, + vendorName, fs, bold, direction, @@ -39,6 +40,7 @@ export default function FoodPrice({
{t("food:discount_applied", { discountAmount: discountAmount, + vendorName: vendorName, })}
)} @@ -54,8 +56,9 @@ export default function FoodPrice({ anyMoney(displayableNoncashLedgerContributionAmount) && ({t("food:subsidy_and_discount_applied", { + discountAmount: discountAmount, + vendorName: vendorName, subsidyAmount: displayableNoncashLedgerContributionAmount, - discountAmount: displayableNoncashLedgerContributionAmount, })}
)} diff --git a/webapp/src/pages/FoodCart.jsx b/webapp/src/pages/FoodCart.jsx index ef047f91..60a779f6 100644 --- a/webapp/src/pages/FoodCart.jsx +++ b/webapp/src/pages/FoodCart.jsx @@ -93,10 +93,10 @@ export default function FoodCart() { customerCost: cart.customerCost, })} - {anyMoney(cart.displayableNoncashLedgerContributionAmount) && ( + {anyMoney(cart.noncashLedgerContributionAmount) && ({t("food:from_vendor", { vendorName: vendor.name })}
+{product.description}