Commit Graph

17765 Commits

Author SHA1 Message Date
Ahmed Ejaz
2fe28d1707 Merge pull request #14101 from mkllnk/taler-currency
Use real currency for Taler payments unless using demo backend
2026-03-25 20:44:44 +05:00
Rachel Arnould
dcf3ab74b8 Merge pull request #13962 from mkllnk/taler-credit
Credit customers via Taler
2026-03-25 15:24:06 +01:00
Maikel Linke
fe0c6a4deb Use real currency for Taler payments unless using demo backend. 2026-03-25 15:09:43 +11:00
David Cook
5e92fa9a17 Merge pull request #14078 from rioug/fix-flacky-order-cylcle-spec
[Spec] Fix flaky order cycle spec
2026-03-23 12:24:05 +11:00
Gaetan Craig-Riou
d6c69fdc2c Fix code typo
Co-authored-by: Maikel <maikel@email.org.au>
2026-03-23 10:48:27 +11:00
Rachel Arnould
06d6db5a07 Merge pull request #14075 from gbathree/13688-fix-button-font-consistency
Fix: unify font-family across all .button elements
2026-03-20 11:03:51 +01:00
Rachel Arnould
3f81883bc7 Merge pull request #14061 from mvanhorn/fix/enterprise-user-inline-error-style
Fix inline error style in Add Manager dialog
2026-03-20 11:03:32 +01:00
Rachel Arnould
27be0f6fd1 Merge pull request #13912 from dacook/sourced-variant1-13887
Create linked variants
2026-03-20 10:59:46 +01:00
Gaetan Craig-Riou
4dc44c6156 Fix code syntax 2026-03-20 15:49:41 +11:00
Gaetan Craig-Riou
8defb2f4c8 Improve EnterpriseFee loading
Request is only send if there isn't another currently running, and also
ensure that filtered enterprise fees are loaded only when not other
request is running.
2026-03-20 14:38:49 +11:00
Maikel Linke
b4b3e21cf6 Replace deprecated option bypass
- https://github.com/heartcombo/devise/pull/5803
2026-03-20 11:32:49 +11:00
Maikel Linke
ce90ec0f5b Ignore unused authentication_token column 2026-03-20 11:32:49 +11:00
Maikel Linke
2998432744 Remove use of devise token_authenticable
Our production servers don't show any use of this feature. The
associated column is nil for all users.

The gem has not been updated in seven years and it's blocking an
important upgrade of devise.
2026-03-20 11:32:48 +11:00
Maikel
c5aaecf76a Merge pull request #13961 from mkllnk/taler-checkout-stock-error
Taler checkout stock error
2026-03-20 11:29:58 +11:00
Greg Austic
032953e7d6 Fix: unify font-family across all .button elements
<button> elements don't inherit font-family from parent by default
in all browsers, causing a visible font mismatch between the
link-based buttons (Back To Store, Back To Website, Cancel Order)
and the button-tag-based Save Changes button on the order
confirmation page.

Add `font-family: inherit` to the base `.button, button` rule so
all button elements use the inherited page font (Roboto). Remove the
now-redundant `font-family: $body-font` from the `.primary` rule.

Fixes #13688

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 10:22:59 -04:00
Matt Van Horn
1878a39188 Fix inline error style in Add Manager dialog to match product list
Add .field class to the email row in the user invitation modal so
the .formError styles (icon, color, font-size) defined in forms.scss
apply consistently with the product list inline errors.

Fixes #13993
2026-03-18 21:46:21 -07:00
David Cook
8e6f1c4e99 Show display name 2026-03-18 14:30:27 +11:00
David Cook
2004934399 Register only necessary elements
This should be more efficient.

Best viewed with whitespace ignored.
2026-03-18 14:30:23 +11:00
David Cook
827ba1990d Ensure changes are tracked on newly added variant
I considered a few ways to do this. Cloned products are done with MutationObserver but it doesn't quite sit right with me. A dedicated controller for newly added rows would provide a good general solution. But do we want yet another controller? I'm not sure. This works and is pretty simple (although it requires a quick loop over _every_ form element.. let's see if we can avoid that.)
2026-03-18 14:03:11 +11:00
Maikel Linke
9961578fc1 Don't offer to void a refund 2026-03-16 12:56:38 +11:00
Maikel Linke
53c2ef53d5 Call #credit with right arguments 2026-03-16 12:56:22 +11:00
Gaetan Craig-Riou
c134bbf49b Add missing ability for credit customer
Fix the specs to use a non super admin user, so it should catch missing
ability in the future.
2026-03-11 15:34:27 +11:00
Maikel Linke
35e03ea3c7 Check stock before completing order after Taler payment 2026-03-11 15:12:21 +11:00
Maikel Linke
9ca1a9e33f Allow orders to be paid before checkout
Taler puts the payment completion into the hands of the user. So we
can't strictly finalise the payment and order together.

And in the bigger picture, it should be okay if a payment goes through
but we have to abort checkout due to stock issues. Then we want to be
able to check out again, using the existing complete payment. Any
refunds can be handled later by the shop owner.
2026-03-11 14:46:06 +11:00
Maikel Linke
7619062ad2 Revert "Move payment action logic to payment"
This reverts commit fdd22bc097.

And it adds the now needed `can_credit?` method to Taler.
It's just a duplicate.
2026-03-11 11:32:08 +11:00
David Cook
18fb1cfa74 Rename variant 'owner' to 'hub'
As discussed by team, and using same nomenclature as VariantOverride.
2026-03-11 11:09:13 +11:00
David Cook
e9ce2df5a9 Rename 'source variant' to linked variant (in most places)
There are two types of linked variant associations: source and target, so we need to keep the name there.
But when cloning a variant and retaining a link as source,  we will prefer the general term 'linked variant'. Hopefully this name works well.
2026-03-11 11:09:13 +11:00
David Cook
c165ade4ba Avoid unnecessary save
Actually, the variant factory is still adding an extra save. We should refactor Variant to avoid that.. but the afternoon slump has got me.
2026-03-11 11:09:12 +11:00
David Cook
7e8b3694be Move class instance variable to helper 2026-03-11 11:09:12 +11:00
David Cook
05c31db46a Remove touch
I think I was just following convention from existing relationships. Perhaps you could argue that a variant is affected by the links added/removed.. but we never look at updated_at so really there's no point at all.
2026-03-11 11:09:12 +11:00
David Cook
299ada1220 Refactor: move variant duplication to model
I tried to avoid it but rubocop made me move it. I think maybe it will need to go into a concern or service class later, but hopefully it's ok here for now.
2026-03-11 11:09:12 +11:00
David Cook
5757f086ec Set owner enterprise when creating source variant 2026-03-11 11:09:12 +11:00
David Cook
8955ffe126 AddOwnerToSpreeVariants [migration]
Should existing variants be migrated to have an owner (copied from supplier)? No, because you can change supplier. This concept needs work.
2026-03-11 11:09:09 +11:00
David Cook
b26152cf0e Only show option when you have permission
Preload the allow list once in the controller. This controller was initially set up to avoid instance variables, and pass variables explicitly to the template. That's a good principle, but in practice we have a growing list of variables passed down the chain to multiple partials which is getting cumbersome. I think instance variables have their place after all.
2026-03-11 11:08:50 +11:00
David Cook
78db179ff3 haml-lint:disable ViewLength
TIL we have linting on haml.

I couldn't think of a better way to handle this but would be glad to receive feedback.
2026-03-11 11:08:50 +11:00
David Cook
5fc6d25a69 Display presence of variant link in UI
It's quite ugly. But we will be iterating on this later.
2026-03-11 11:08:50 +11:00
David Cook
b877540f5f Create sourced variant link on clone 2026-03-11 11:08:50 +11:00
copilot-swe-agent[bot]
04c0adf960 Fix source_variants and target_variants associations in Variant model
Co-authored-by: dacook <4188088+dacook@users.noreply.github.com>

Thanks co-pilot for sending me in the right direction.
Would this be neater as a has_and_belongs_to_many? Maybe but I will try to keep moving.
2026-03-11 11:08:50 +11:00
David Cook
1c89e9979e CreateVariantLinks [migration]
Tried using the rails generator, but as usual it was a waste of time becuase it doesn't handle unusual cases.

I found more good guidance from that stackoverflow post:
> why are you worrying about your indexes? Build your app!

Something's not right in the model, see next commit.
2026-03-11 11:08:47 +11:00
David Cook
eba2fbcc30 Create source variants 2026-03-11 11:07:08 +11:00
David Cook
940aa57daf Set up permissions for creating source variants 2026-03-11 11:07:08 +11:00
David Cook
6fe2357ca0 Add enterprise permission create_sourced_variants 2026-03-11 11:07:08 +11:00
David Cook
bd01b5f113 Add 'create sourced variant' option in variant actions menu
For now, we will only be able to create sourced variant from variants that are visible to us (variants that we manage)

    In a later commit I will hide the option if you can't use it
2026-03-11 11:07:08 +11:00
Maikel Linke
fb2dfed6bf Pass amount to payment mailer
We now include the refunded amount in the email to the customer. When
voiding a payment, it's the full amount of the payment. When giving back
credit then it's only the money that has been paid too much.
2026-03-11 10:58:30 +11:00
Maikel Linke
cf53ac1990 Add credit action to Taler 2026-03-11 10:58:30 +11:00
Maikel Linke
fdd22bc097 Move payment action logic to payment
At closer inspection, almost all logic around which payment actions to
display involves only the state of the payment. So I moved the logic
there.

We now have one list of all possible actions supported by the UX. Then
payment methods can declare a list of supported actions. If that's
conditional, they can implement the conditions themselves. The payment
model itself then still filters the actions based on its state.
2026-03-11 10:58:30 +11:00
Maikel Linke
956c4a27c2 Remove unnecessary guard clause
Previously, payment actions that were listed without an associated
`can_?` method were interpreted as supported. All payment methods are
implementing all `can_?` methods for listed actions though. And I think
that new payment methods should explicitely implement all `can_?`
methods instead of relying on this hidden logic.
2026-03-11 10:58:30 +11:00
Maikel Linke
2b32f6b909 Make payment method source of truth of supported actions 2026-03-11 10:58:30 +11:00
Maikel Linke
303b91af5e Move list of payment actions from card to gateway
We currently ask the credit card first which payment actions like "void"
it supports. But all the logic is not card specifc. It depends on the
payment method which actions it supports.

And instead of having two different classes potentially being the source
of truth for actions, I prefer leaving that responsibility with exactly
one class, the payment method.

I'll move the `can_?` methods next.
2026-03-11 10:58:30 +11:00
Maikel Linke
ce96b58800 Remove useless setting of payment amount
It gets overridden later anyway.
2026-03-11 10:58:25 +11:00