duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
147 stars 41 forks source link

100% discount on order not working #821

Closed kevinmeijer97 closed 1 year ago

kevinmeijer97 commented 1 year ago

Description

A client of ours wants to give out 100% free coupons for some products, this means that sometimes the total order value will be 0. When you have a 0 euro order and use Mollie as your payment provider, the moment you press pay to redirect to mollie it gives out the following error: Mollie\Api\Exceptions\ApiException [2023-02-17T13:36:32+0100] Error executing API call (422: Unprocessable Entity): The amount contains an invalid value. Field: amount.value. Documentation: https://docs.mollie.com/overview/handling-errors Mollie can't handle 0 euro orders, which makes sense since theres nothing to pay. What would make sense to me is to check for 0 value before redirecting to Mollie for payment.

Steps to reproduce

  1. Setup basic checkout with Mollie as your payment provider
  2. Create a 100% off coupon
  3. Try and pay for the order

Environment

Environment Application Name: Laravel Version: 9.52.0 PHP Version: 8.1.11 Composer Version: 2.5.4 Environment: production Debug Mode: OFF URL: cityapptour.com Maintenance Mode: OFF

Cache Config: CACHED Events: NOT CACHED Routes: CACHED Views: CACHED

Drivers Broadcasting: log Cache: redis Database: mysql Logs: daily Mail: smtp Queue: redis Session: redis

Simple Commerce Gateways: Dummy, Mollie Repository: Customer: DoubleThreeDigital\SimpleCommerce\Customers\EloquentCustomerRepository Repository: Order: DoubleThreeDigital\SimpleCommerce\Orders\EloquentOrderRepository Repository: Product: DoubleThreeDigital\SimpleCommerce\Products\EntryProductRepository Shipping Methods: Standard Post Tax Engine: DoubleThreeDigital\SimpleCommerce\Tax\Standard\TaxEngine

Statamic Addons: 10 Antlers: regex Stache Watcher: Enabled Static Caching: full Version: 3.3.68 PRO

Statamic Addons doublethreedigital/runway: 2.6.0 doublethreedigital/simple-commerce: 4.2.3 edalzell/blade-directives: 3.7 justbetter/sc-import-variant-data: dev-develop justbetter/statamic-image-optimize: 1.1.4 mitydigital/iconamic: 1.1.2 simonridley/tracking-code-manager: dev-master spatie/statamic-responsive-images: 2.15.2 webographen/statamic-dynamic-token: 1.0.0 withcandour/aardvark-seo: 2.0.30

duncanmcclean commented 1 year ago

Thanks for reporting this!

Instead of Simple Commerce trying to redirect the user to the off-site gateway for £0 orders, it'll now mark the order as paid and send them directly to the redirect URL you have set on the {{ sc:checkout:mollie }} tag.


Released as part of v4.5.5.