Commit Graph

365 Commits

Author SHA1 Message Date
David Cook
d195882645 Use builtin Rails method 2023-06-15 15:26:22 +10:00
Maikel Linke
75cce8bc19 Simplify customer code
The API endpoint merges the created_manually flag in the params already.
No need to write it separately.
2023-06-15 12:02:45 +10:00
Mohamed ABDELLANI
298ae8ffc3 set create_manualll flag if the customer already exists 2023-06-15 12:02:45 +10:00
Mohamed ABDELLANI
ebc3073604 use Customer#visible on the customers listing endpoints
Update app/models/customer.rb

Co-authored-by: Maikel <maikel@email.org.au>

Update spec/models/customer_spec.rb

Co-authored-by: Maikel <maikel@email.org.au>

Update spec/models/customer_spec.rb

Co-authored-by: Maikel <maikel@email.org.au>

authorize created_manually field to be set on APIv1
2023-06-15 12:02:45 +10:00
Gaetan Craig-Riou
41b3ddae08 Merge pull request #10714 from macanudo527/fix_linelength
Fix Style/LineLength
2023-06-12 09:53:23 +10:00
Neal Chambers
449430cabc Indent code to be more Readable 2023-06-09 16:39:29 +09:00
Matt-Yorkley
f4261b85b8 Merge pull request #10940 from Matt-Yorkley/order-tidyup
Order class tidyup
2023-06-08 15:06:59 +01:00
Matt-Yorkley
f3ee10dd5a Simplify by moving conditional to guard clause 2023-06-07 13:01:37 +01:00
Matt-Yorkley
cf0f148dba Advance order when creating a shipment
This action gets called from the order edit page when adding line items and it's one of the places that needs to advance the order *before* redirecting back to the order edit action
2023-06-07 13:01:37 +01:00
Matt-Yorkley
3dd4e7ef03 Delegate order updater method 2023-06-05 23:54:04 +01:00
Filipe
12159edaca Merge pull request #10833 from Matt-Yorkley/order-angular
Remove Angular from admin orders index page
2023-06-01 13:57:39 +01:00
Matt-Yorkley
a20277c3a7 Completely remove option_values and option_types from the codebase 2023-06-01 10:12:19 +01:00
Matt-Yorkley
61849d84e7 Extract order capturing to OrderCaptureService 2023-05-21 00:15:32 +01:00
Matt-Yorkley
1995a44848 Improve eager-loading on admin products page adn resolve issue with serializer
For some reason eager-loaded data isn't passed to nested serializers when using associations. Defining the association as a method and passing in some optional paramaters resolves the issue.

This reduces queries run by the controller action by around 75%, as well as the response times.
2023-05-06 17:15:27 +01:00
Mohamed ABDELLANI
03cb14c926 define manage_by scope on customer model 2023-04-11 12:18:15 +01:00
Mohamed ABDELLANI
da78e06a39 load customers of managed enterprises only 2023-04-11 12:10:07 +01:00
Mikael Norlén
e95d08cae8 Add balance to api v1 customers endpoint
- customers#show: Add balance (data_type: double) to customer attributes.
- customers#index: Add balance only if specified in extra_fields
query parameter: extra_fields[customer]=balance
2023-02-15 11:14:27 +01:00
Mikael Norlén
22b1dd3232 Add support for extra_fields query parameter
Api now supports optional fields.
These are included with the extra_fields query param.

Syntax: extra_fields[type]=field1,field2
2023-02-15 11:14:27 +01:00
Maikel Linke
a08c7f7823 Sort customers by id on API v1 2023-02-10 15:52:35 +11:00
Maikel Linke
52e934ec2b Consistently use our FeatureToggle module
Direct calls to Flipper have the downside that we can't add any new
functionality like storing the feature in the database when used.
2022-10-08 16:23:17 +02:00
jibees
20ee0d5009 Merge pull request #9301 from mkllnk/3975-unsupported-image
Allow SVG images for products and show errors when uploading unsupported file
2022-07-21 16:56:11 +02:00
Maikel Linke
19018c2564 Split address transformation for easier reading 2022-07-19 09:49:42 +10:00
Maikel Linke
c8a65d2fac Simplify with customer accessor 2022-07-19 09:49:42 +10:00
Maikel Linke
6c0d4cffe5 Allow customer's address update with country code
The customer endpoint now serves 2-letter ISO codes for countries and
accepts these for updates. It also serves and accepts region codes
(abbreviations) like VIC for Victoria.

Updates treat these fields as case-insensitive and either code or name
have to be present.

This commit also updates the Swagger documentation.
2022-07-19 09:49:42 +10:00
Jean-Baptiste Bellet
cc135c8190 API V1, Customer endpoint: region and country as object 2022-07-15 14:54:33 +02:00
Jean-Baptiste Bellet
afa40ea82f Authorize product and not @product 2022-07-13 14:26:11 +02:00
Jean-Baptiste Bellet
90af6bd22d Handle note saving with a new action on existing API controller 2022-07-05 10:09:20 +02:00
Maikel
553046addb Merge pull request #9255 from jibees/fix-admin-taxonomies-interface
Fix admin taxonomies interface
2022-06-21 09:41:55 +10:00
Maikel Linke
5f11b6a650 Respond with errors if image upload fails 2022-06-14 15:06:17 +10:00
Maikel Linke
831aa3aae0 Simplify ProductImagesController 2022-06-14 14:50:55 +10:00
Filipe
9fee4f1554 Merge pull request #9203 from AgriculturaFamiliar/remove-closed-associated-adjustments-button
Remove closed associated adjustments button
2022-06-10 10:10:50 +01:00
Jean-Baptiste Bellet
817b5f437f Authorize :position params 2022-06-02 15:41:44 +02:00
Maikel Linke
4a0ed99919 Replace Paperclip on Enterprise model
We configured Paperclip to convert images to JPG in some cases but I
omitted that here because we don't need it. If an image is better
represented as PNG or another format then the user should be able to
choose that.

Some specs were also testing the generated URL but the Active Storage
URL doesn't contain a style name anymore and it's not helpful to test
the URL.
2022-06-01 17:16:55 +10:00
Arthur Vieira
95010fcd12 Remove the unlock condition in shipment controller
This assumes unlock is always true so the shipment's fee adjustments
always opens and closes.
2022-05-26 09:21:48 -03:00
Sebastian Castro
287e8f5845 Reports Refactor 3
Easily group and create header and summary row
Auto format cells when appropriate type (boolean, dates) and render_format (neither csv nor json)
2022-05-12 16:54:13 +02:00
Sebastian Castro
452a3fa933 Reports Refactor 2: Merge Spree::reports into Admin::Reports 2022-05-12 16:54:13 +02:00
GeorgeThoppil
8903496a1b Optional restocking items 2022-05-06 10:55:24 -04:00
Maikel Linke
ba1e21ad75 Feature-toggle API also per API key
We looked only at logged in users (session cookie) before.
2022-04-15 12:34:57 +10:00
Maikel Linke
5063f377c3 Enable relationship inclusion for customers#show
This will allow us to include address records.
2022-03-28 11:04:30 +11:00
Maikel Linke
d789fb32e9 Make customer's address writable on API 2022-03-28 11:04:30 +11:00
Maikel Linke
51420934f3 Add billing and shipping address to customer 2022-03-28 10:58:18 +11:00
Maikel Linke
adc7e97e62 Add tag list to customer endpoint 2022-03-28 10:55:58 +11:00
Maikel Linke
aa6e5ae799 Report useful error message in missing parameter 2022-03-28 10:55:57 +11:00
Maikel Linke
8d12c7a692 Permit more customer attributes for update 2022-03-28 10:55:57 +11:00
Maikel Linke
41746459fa Restrict allow_charges attribute to read-only
We want people to use the UI to change this attribute.
2022-03-28 10:55:57 +11:00
Maikel Linke
12d989568e Safer API error reporting
We don't know what unknown errors would report. They could expose
sensitive data. So let's not pass that data on to the public while we
have the full details in Bugsnag.

Also, let's not catch Exception because that could catch interrupts to
gracefully shut down the application.
2022-03-02 11:59:35 +11:00
Maikel Linke
4aa70c1ffd Render pagination errors 2022-03-02 11:59:35 +11:00
Maikel Linke
414bf5d074 Don't list guest customer records to guest users 2022-03-02 11:59:35 +11:00
Matt-Yorkley
3dbf00f302 Add pagination with Pagy using structure from JSON:API specification
https://jsonapi.org/examples/#pagination

Update schema for collections rendered with pagination data
2022-03-02 11:58:04 +11:00
Matt-Yorkley
c102ce8e7e Add RequestTimeout concern 2022-03-02 11:58:04 +11:00