mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
Merge branch 'dev' for release 6.0.7
This commit is contained in:
commit
a23de67bd5
@ -1,5 +1,12 @@
|
|||||||
# Changelog Fab-manager
|
# Changelog Fab-manager
|
||||||
|
|
||||||
|
## v6.0.7 2023 June 20
|
||||||
|
|
||||||
|
- Fix a bug: OpenAPI accounting gateway_object_id missing error
|
||||||
|
- Fix a bug: unable to modify the price of prepaid pack
|
||||||
|
- Fix a bug: notification type missing
|
||||||
|
- Fix critical bug: Incorrect amount calculation when paying monthly subcription with a wallet for PayZen
|
||||||
|
|
||||||
## v6.0.6 2023 May 4
|
## v6.0.6 2023 May 4
|
||||||
|
|
||||||
- Fix a bug: invalid duration for machine/spaces reservations in statistics, when using slots of not 1 hour
|
- Fix a bug: invalid duration for machine/spaces reservations in statistics, when using slots of not 1 hour
|
||||||
|
@ -115,6 +115,8 @@ export const ConfigurePacksButton: React.FC<ConfigurePacksButtonProps> = ({ pack
|
|||||||
itemId={p.id}
|
itemId={p.id}
|
||||||
itemType={t('app.admin.configure_packs_button.pack')}
|
itemType={t('app.admin.configure_packs_button.pack')}
|
||||||
destroy={PrepaidPackAPI.destroy}/>
|
destroy={PrepaidPackAPI.destroy}/>
|
||||||
|
</li>)}
|
||||||
|
</ul>
|
||||||
<FabModal isOpen={isOpen}
|
<FabModal isOpen={isOpen}
|
||||||
toggleModal={toggleModal}
|
toggleModal={toggleModal}
|
||||||
title={t('app.admin.configure_packs_button.edit_pack')}
|
title={t('app.admin.configure_packs_button.edit_pack')}
|
||||||
@ -124,8 +126,6 @@ export const ConfigurePacksButton: React.FC<ConfigurePacksButtonProps> = ({ pack
|
|||||||
onConfirmSendFormId="edit-pack">
|
onConfirmSendFormId="edit-pack">
|
||||||
{packData && <PackForm formId="edit-pack" onSubmit={handleUpdate} pack={packData} />}
|
{packData && <PackForm formId="edit-pack" onSubmit={handleUpdate} pack={packData} />}
|
||||||
</FabModal>
|
</FabModal>
|
||||||
</li>)}
|
|
||||||
</ul>
|
|
||||||
{packs?.length === 0 && <span>{t('app.admin.configure_packs_button.no_packs')}</span>}
|
{packs?.length === 0 && <span>{t('app.admin.configure_packs_button.no_packs')}</span>}
|
||||||
</FabPopover>}
|
</FabPopover>}
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +20,7 @@ class Footprintable < ApplicationRecord
|
|||||||
return false unless persisted?
|
return false unless persisted?
|
||||||
|
|
||||||
reload
|
reload
|
||||||
footprint_children.map(&:check_footprint).all? && !chained_element.corrupted?
|
footprint_children.map(&:check_footprint).all? && chained_element && !chained_element.corrupted?
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [ChainedElement]
|
# @return [ChainedElement]
|
||||||
|
@ -175,8 +175,8 @@ class Invoice < PaymentDocument
|
|||||||
if paid_by_card?
|
if paid_by_card?
|
||||||
{
|
{
|
||||||
payment_mean: mean,
|
payment_mean: mean,
|
||||||
gateway_object_id: payment_gateway_object.gateway_object_id,
|
gateway_object_id: payment_gateway_object&.gateway_object_id,
|
||||||
gateway_object_type: payment_gateway_object.gateway_object_type
|
gateway_object_type: payment_gateway_object&.gateway_object_type
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
when :wallet
|
when :wallet
|
||||||
|
@ -14,8 +14,8 @@ if payment_schedule.operator_profile
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
json.main_object do
|
json.main_object do
|
||||||
json.type payment_schedule.main_object.object_type
|
json.type payment_schedule.main_object&.object_type
|
||||||
json.id payment_schedule.main_object.object_id
|
json.id payment_schedule.main_object&.object_id
|
||||||
end
|
end
|
||||||
if payment_schedule.gateway_subscription
|
if payment_schedule.gateway_subscription
|
||||||
# this attribute is used to known which gateway should we interact with, in the front-end
|
# this attribute is used to known which gateway should we interact with, in the front-end
|
||||||
|
@ -1,33 +1,89 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
unless NotificationType.find_by(name: 'notify_member_training_authorization_expired')
|
NOTIFICATIONS_TYPES = [
|
||||||
NotificationType.create!(
|
{ name: 'notify_admin_when_project_published', category: 'projects', is_configurable: true },
|
||||||
name: 'notify_member_training_authorization_expired',
|
{ name: 'notify_project_collaborator_to_valid', category: 'projects', is_configurable: false },
|
||||||
category: 'trainings',
|
{ name: 'notify_project_author_when_collaborator_valid', category: 'projects', is_configurable: true },
|
||||||
is_configurable: false
|
{ name: 'notify_user_training_valid', category: 'trainings', is_configurable: false },
|
||||||
)
|
{ name: 'notify_member_subscribed_plan', category: 'subscriptions', is_configurable: false },
|
||||||
end
|
{ name: 'notify_member_create_reservation', category: 'agenda', is_configurable: false },
|
||||||
|
{ name: 'notify_member_subscribed_plan_is_changed', category: 'deprecated', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_member_create_reservation', category: 'agenda', is_configurable: true },
|
||||||
|
{ name: 'notify_member_slot_is_modified', category: 'agenda', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_slot_is_modified', category: 'agenda', is_configurable: true },
|
||||||
|
|
||||||
unless NotificationType.find_by(name: 'notify_member_training_invalidated')
|
{ name: 'notify_admin_when_user_is_created', category: 'users_accounts', is_configurable: true },
|
||||||
NotificationType.create!(
|
{ name: 'notify_admin_subscribed_plan', category: 'subscriptions', is_configurable: true },
|
||||||
name: 'notify_member_training_invalidated',
|
{ name: 'notify_user_when_invoice_ready', category: 'payments', is_configurable: true },
|
||||||
category: 'trainings',
|
{ name: 'notify_member_subscription_will_expire_in_7_days', category: 'subscriptions', is_configurable: false },
|
||||||
is_configurable: false
|
{ name: 'notify_member_subscription_is_expired', category: 'subscriptions', is_configurable: false },
|
||||||
)
|
{ name: 'notify_admin_subscription_will_expire_in_7_days', category: 'subscriptions', is_configurable: true },
|
||||||
end
|
{ name: 'notify_admin_subscription_is_expired', category: 'subscriptions', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_subscription_canceled', category: 'subscriptions', is_configurable: true },
|
||||||
|
{ name: 'notify_member_subscription_canceled', category: 'subscriptions', is_configurable: false },
|
||||||
|
{ name: 'notify_user_when_avoir_ready', category: 'wallet', is_configurable: false },
|
||||||
|
|
||||||
unless NotificationType.find_by(name: 'notify_admin_order_is_paid')
|
{ name: 'notify_member_slot_is_canceled', category: 'agenda', is_configurable: false },
|
||||||
NotificationType.create!(
|
{ name: 'notify_admin_slot_is_canceled', category: 'agenda', is_configurable: true },
|
||||||
name: 'notify_admin_order_is_paid',
|
{ name: 'notify_partner_subscribed_plan', category: 'subscriptions', is_configurable: false },
|
||||||
category: 'shop',
|
{ name: 'notify_member_subscription_extended', category: 'subscriptions', is_configurable: false },
|
||||||
is_configurable: true
|
{ name: 'notify_admin_subscription_extended', category: 'subscriptions', is_configurable: true },
|
||||||
)
|
{ name: 'notify_admin_user_group_changed', category: 'users_accounts', is_configurable: true },
|
||||||
end
|
{ name: 'notify_user_user_group_changed', category: 'users_accounts', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_when_user_is_imported', category: 'users_accounts', is_configurable: true },
|
||||||
|
{ name: 'notify_user_profile_complete', category: 'users_accounts', is_configurable: false },
|
||||||
|
{ name: 'notify_user_auth_migration', category: 'user', is_configurable: false },
|
||||||
|
|
||||||
|
{ name: 'notify_admin_user_merged', category: 'users_accounts', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_profile_complete', category: 'users_accounts', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_abuse_reported', category: 'projects', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_invoicing_changed', category: 'deprecated', is_configurable: false },
|
||||||
|
{ name: 'notify_user_wallet_is_credited', category: 'wallet', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_user_wallet_is_credited', category: 'wallet', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_export_complete', category: 'exports', is_configurable: false },
|
||||||
|
{ name: 'notify_member_about_coupon', category: 'agenda', is_configurable: false },
|
||||||
|
{ name: 'notify_member_reservation_reminder', category: 'agenda', is_configurable: false },
|
||||||
|
|
||||||
|
{ name: 'notify_admin_free_disk_space', category: 'app_management', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_close_period_reminder', category: 'accountings', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_archive_complete', category: 'accountings', is_configurable: true },
|
||||||
|
{ name: 'notify_privacy_policy_changed', category: 'app_management', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_import_complete', category: 'app_management', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_refund_created', category: 'wallet', is_configurable: true },
|
||||||
|
{ name: 'notify_admins_role_update', category: 'users_accounts', is_configurable: true },
|
||||||
|
{ name: 'notify_user_role_update', category: 'users_accounts', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_objects_stripe_sync', category: 'payments', is_configurable: false },
|
||||||
|
{ name: 'notify_user_when_payment_schedule_ready', category: 'payments', is_configurable: false },
|
||||||
|
|
||||||
|
{ name: 'notify_admin_payment_schedule_failed', category: 'payments', is_configurable: true },
|
||||||
|
{ name: 'notify_member_payment_schedule_failed', category: 'payments', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_payment_schedule_check_deadline', category: 'payments', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_payment_schedule_transfer_deadline', category: 'payments', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_payment_schedule_error', category: 'payments', is_configurable: true },
|
||||||
|
{ name: 'notify_member_payment_schedule_error', category: 'payments', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_payment_schedule_gateway_canceled', category: 'payments', is_configurable: true },
|
||||||
|
{ name: 'notify_member_payment_schedule_gateway_canceled', category: 'payments', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_user_supporting_document_files_created', category: 'supporting_documents', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_user_supporting_document_files_updated', category: 'supporting_documents', is_configurable: true },
|
||||||
|
|
||||||
|
{ name: 'notify_user_is_validated', category: 'users_accounts', is_configurable: false },
|
||||||
|
{ name: 'notify_user_is_invalidated', category: 'users_accounts', is_configurable: false },
|
||||||
|
{ name: 'notify_user_supporting_document_refusal', category: 'supporting_documents', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_user_supporting_document_refusal', category: 'supporting_documents', is_configurable: true },
|
||||||
|
{ name: 'notify_user_order_is_ready', category: 'shop', is_configurable: false },
|
||||||
|
{ name: 'notify_user_order_is_canceled', category: 'shop', is_configurable: false },
|
||||||
|
{ name: 'notify_user_order_is_refunded', category: 'shop', is_configurable: false },
|
||||||
|
{ name: 'notify_admin_low_stock_threshold', category: 'shop', is_configurable: true },
|
||||||
|
{ name: 'notify_admin_training_auto_cancelled', category: 'trainings', is_configurable: true },
|
||||||
|
{ name: 'notify_member_training_auto_cancelled', category: 'trainings', is_configurable: false }
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
NOTIFICATIONS_TYPES.each do |notification_type|
|
||||||
|
next if NotificationType.find_by(name: notification_type[:name])
|
||||||
|
|
||||||
unless NotificationType.find_by(name: 'notify_member_reservation_limit_reached')
|
|
||||||
NotificationType.create!(
|
NotificationType.create!(
|
||||||
name: 'notify_member_reservation_limit_reached',
|
name: notification_type[:name],
|
||||||
category: 'agenda',
|
category: notification_type[:category],
|
||||||
is_configurable: false
|
is_configurable: notification_type[:is_configurable]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -25,9 +25,16 @@ class PayZen::Service < Payment::Service
|
|||||||
order_id: order_id
|
order_id: order_id
|
||||||
}
|
}
|
||||||
unless first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero?
|
unless first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero?
|
||||||
params[:initial_amount] = payzen_amount(first_item.amount)
|
initial_amount = first_item.amount
|
||||||
|
initial_amount -= payment_schedule.wallet_amount if payment_schedule.wallet_amount
|
||||||
|
if initial_amount.zero?
|
||||||
|
params[:effect_date] = (first_item.due_date + 1.month).iso8601
|
||||||
|
params[:rrule] = rrule(payment_schedule, -1)
|
||||||
|
else
|
||||||
|
params[:initial_amount] = payzen_amount(initial_amount)
|
||||||
params[:initial_amount_number] = 1
|
params[:initial_amount_number] = 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
pz_subscription = client.create_subscription(**params)
|
pz_subscription = client.create_subscription(**params)
|
||||||
|
|
||||||
# save payment token
|
# save payment token
|
||||||
@ -123,16 +130,21 @@ class PayZen::Service < Payment::Service
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def rrule(payment_schedule)
|
def rrule(payment_schedule, offset = 0)
|
||||||
count = payment_schedule.payment_schedule_items.count
|
count = payment_schedule.payment_schedule_items.count
|
||||||
"RRULE:FREQ=MONTHLY;COUNT=#{count}"
|
"RRULE:FREQ=MONTHLY;COUNT=#{count + offset}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# check if the given transaction matches the given PaymentScheduleItem
|
# check if the given transaction matches the given PaymentScheduleItem
|
||||||
def transaction_matches?(transaction, payment_schedule_item)
|
def transaction_matches?(transaction, payment_schedule_item)
|
||||||
transaction_date = Time.zone.parse(transaction['creationDate']).to_date
|
transaction_date = Time.zone.parse(transaction['creationDate']).to_date
|
||||||
|
|
||||||
transaction['amount'] == payment_schedule_item.amount &&
|
amount = payment_schedule_item.amount
|
||||||
|
if !payment_schedule_item.details['adjustment']&.zero? && payment_schedule_item.payment_schedule.wallet_amount
|
||||||
|
amount -= payment_schedule_item.payment_schedule.wallet_amount
|
||||||
|
end
|
||||||
|
|
||||||
|
transaction['amount'] == amount &&
|
||||||
transaction_date >= payment_schedule_item.due_date.to_date &&
|
transaction_date >= payment_schedule_item.due_date.to_date &&
|
||||||
transaction_date <= payment_schedule_item.due_date.to_date + 7.days
|
transaction_date <= payment_schedule_item.due_date.to_date + 7.days
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fab-manager",
|
"name": "fab-manager",
|
||||||
"version": "6.0.6",
|
"version": "6.0.7",
|
||||||
"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.",
|
"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": [
|
"keywords": [
|
||||||
"fablab",
|
"fablab",
|
||||||
|
Loading…
Reference in New Issue
Block a user