Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNOE-1195] Support product notification settings #746

Open
wants to merge 1 commit into
base: 4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
json.extract! product, :id, :nid, :name, :active, :product_type, :logo, :external_id, :externally_provisioned, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :single_billing_enabled, :billed_locally, :created_at, :updated_at
json.extract! product, :id, :nid, :name, :active, :product_type, :logo, :external_id, :externally_provisioned, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :single_billing_enabled, :billed_locally, :notification_on_success, :notification_on_failure, :notification_on_approval, :created_at, :updated_at

json.values_attributes do
json.array! product.values.each do |value|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
json.extract! product, :id, :nid, :name, :active, :product_type, :logo, :external_id, :externally_provisioned, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :local, :single_billing_enabled, :billed_locally
json.extract! product, :id, :nid, :name, :active, :product_type, :logo, :external_id, :externally_provisioned, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :local, :single_billing_enabled, :billed_locally, :notification_on_success, :notification_on_failure, :notification_on_approval

json.values_attributes do
json.array! product.values.each do |value|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module MnoEnterprise::Concerns::Controllers::Jpi::V1::Admin::ProductsController
extend ActiveSupport::Concern

ATTRIBUTES = [:name, :active, :logo, :external_id, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :single_billing_enabled, :billed_locally]
ATTRIBUTES = [:name, :active, :logo, :external_id, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :single_billing_enabled, :billed_locally, :notification_on_success, :notification_on_failure, :notification_on_approval]
DEPENDENCIES = [:'values.field', :assets, :categories, :product_pricings, :product_contracts]
PRICING_ATTRIBUTES = [:name, :description, :position, :free, :pricing_type, :free_trial_enabled, :free_trial_duration, :free_trial_unit, :per_duration, :per_unit, {:prices => [:currency, :price_cents] }, :external_id]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def partial_hash_for_product(product)
"local" => product.local,
"single_billing_enabled" => product.single_billing_enabled,
"billed_locally" => product.billed_locally,
"notification_on_success" => product.notification_on_success,
"notification_on_failure" => product.notification_on_failure,
"notification_on_approval" => product.notification_on_approval,
"values_attributes" => product.values,
"assets_attributes" => product.assets,
# "product_pricings" => product.product_pricings
Expand Down
4 changes: 3 additions & 1 deletion core/app/models/mno_enterprise/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class Product < BaseResource
property :single_billing_enabled, type: :boolean
property :billed_locally, type: :boolean
property :available_actions

property :notification_on_success
property :notification_on_failure
property :notification_on_approval

def to_audit_event
{
Expand Down
3 changes: 3 additions & 0 deletions core/lib/mno_enterprise/testing_support/factories/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
externally_provisioned true
custom_schema nil
local false
notification_on_success false
notification_on_failure false
notification_on_approval false
values []
assets []
categories []
Expand Down