Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Jul 13, 2023
2 parents 8003961 + 8cd87f9 commit 7841462
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog Fab-manager

## v6.0.10 2023 July 13

- Fix a bug: unable to confirm payment of store for admin
- Fix a bug: unable to update payment schedule item
- Fix a bug: event reserved places compute error
- [TODO DEPLOY] `rails fablab:setup:build_places_cache`

## v6.0.9 2023 July 07

- Fix a bug: unable to show project step image in markdown file
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/checkout_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def payment

def confirm_payment
authorize @current_order, policy_class: CheckoutPolicy
res = Checkout::PaymentService.new.confirm_payment(@current_order, current_user, params[:coupon_code], params[:payment_id])
res = Checkout::PaymentService.new.confirm_payment(@current_order, params[:coupon_code], params[:payment_id])
render json: res
rescue StandardError => e
render json: e, status: :unprocessable_entity
Expand Down
4 changes: 1 addition & 3 deletions app/services/checkout/payment_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def payment(order, operator, coupon_code, payment_id = '')
end
end

def confirm_payment(order, operator, coupon_code, payment_id = '')
return unless operator.member?

def confirm_payment(order, coupon_code, payment_id = '')
if Stripe::Helper.enabled?
Payments::StripeService.new.confirm_payment(order, coupon_code, payment_id)
elsif PayZen::Helper.enabled?
Expand Down
6 changes: 5 additions & 1 deletion app/services/slots/places_cache_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ def refresh(slot)
reservations = Slots::ReservationsService.reservations(slot.slots_reservations, [reservable])
pending = Slots::ReservationsService.pending_reservations(slot.cart_item_reservation_slots.map(&:id), [reservable])

reserved_places = (reservations[:reservations].count || 0) + (pending[:reservations].count || 0)
if slot.availability.available_type == 'event'
reserved_places = slot.availability.event.nb_total_places - slot.availability.event.nb_free_places
end
places.push({
reservable_type: reservable.class.name,
reservable_id: reservable.try(&:id),
reserved_places: (reservations[:reservations].count || 0) + (pending[:reservations].count || 0),
reserved_places: reserved_places,
user_ids: reservations[:user_ids] + pending[:user_ids]
})
end
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ de:
state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required"
state_paid: "Paid"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ en:
state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required"
state_paid: "Paid"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ es:
state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required"
state_paid: "Paid"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ fr:
state_new: "Pas encore à l'échéance"
state_pending_check: "En attente de l'encaissement du chèque"
state_pending_transfer: "En attente de la confirmation du prélèvement"
state_pending_card: "En attente du paiement par carte"
state_requires_payment_method: "La carte bancaire doit être mise à jour"
state_requires_action: "Action requise"
state_paid: "Payée"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ it:
state_new: "Non ancora scaduto"
state_pending_check: "In attesa di incasso dell'assegno"
state_pending_transfer: "In attesa conferma del bonifico bancario"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "La carta di credito deve essere aggiornata"
state_requires_action: "Azione richiesta"
state_paid: "Pagato"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.no.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@
state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required"
state_paid: "Paid"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ pt:
state_new: "Ainda não vencido"
state_pending_check: "Esperando a validação manual"
state_pending_transfer: "Aguardando a confirmação da transferência"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "O cartão de crédito deve ser atualizado"
state_requires_action: "Ação necessária"
state_paid: "Pago"
Expand Down
1 change: 1 addition & 0 deletions config/locales/app.shared.zu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ zu:
state_new: "crwdns29422:0crwdne29422:0"
state_pending_check: "crwdns29424:0crwdne29424:0"
state_pending_transfer: "crwdns29426:0crwdne29426:0"
state_pending_card: "crwdns37663:0crwdne37663:0"
state_requires_payment_method: "crwdns29428:0crwdne29428:0"
state_requires_action: "crwdns29430:0crwdne29430:0"
state_paid: "crwdns29432:0crwdne29432:0"
Expand Down
4 changes: 2 additions & 2 deletions lib/pay_zen/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_subscription(payment_schedule, order_id, *_args)
rrule: rrule(payment_schedule),
order_id: order_id
}
unless first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero?
if first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero?
initial_amount = first_item.amount
initial_amount -= payment_schedule.wallet_amount if payment_schedule.wallet_amount
if initial_amount.zero?
Expand Down Expand Up @@ -140,7 +140,7 @@ def transaction_matches?(transaction, payment_schedule_item)
transaction_date = Time.zone.parse(transaction['creationDate']).to_date

amount = payment_schedule_item.amount
if !payment_schedule_item.details['adjustment']&.zero? && payment_schedule_item.payment_schedule.wallet_amount
if payment_schedule_item.details['adjustment']&.zero? && payment_schedule_item.payment_schedule.wallet_amount
amount -= payment_schedule_item.payment_schedule.wallet_amount
end

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "6.0.9",
"version": "6.0.10",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",
Expand Down
4 changes: 2 additions & 2 deletions test/services/availabilities/availabilities_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class Availabilities::AvailabilitiesServiceTest < ActiveSupport::TestCase
assert_empty slots
end

test 'admin cannot see past availabilities further than 1 month' do
test 'admin can see past availabilities further than 1 month' do
service = Availabilities::AvailabilitiesService.new(@admin)
slots = service.machines([Machine.find(2)], @no_subscription,
{ start: Time.zone.parse('2015-06-15').beginning_of_day, end: Time.zone.parse('2015-06-15').end_of_day })

assert_empty slots
assert_not_empty slots
end

test 'admin can see past availabilities in 1 month ago' do
Expand Down

0 comments on commit 7841462

Please sign in to comment.