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

[DE-746] Add coupons missing field #32

Merged
merged 1 commit into from
Mar 5, 2024
Merged
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
8 changes: 8 additions & 0 deletions advancedbilling/models/coupon.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Coupon(object):
discount_type (DiscountType): TODO: type description here.
exclude_mid_period_allocations (bool): TODO: type description here.
apply_on_cancel_at_end_of_period (bool): TODO: type description here.
apply_on_subscription_expiration (bool): TODO: type description here.
coupon_restrictions (List[CouponRestriction]): TODO: type description
here.

Expand Down Expand Up @@ -81,6 +82,7 @@ class Coupon(object):
"discount_type": 'discount_type',
"exclude_mid_period_allocations": 'exclude_mid_period_allocations',
"apply_on_cancel_at_end_of_period": 'apply_on_cancel_at_end_of_period',
"apply_on_subscription_expiration": 'apply_on_subscription_expiration',
"coupon_restrictions": 'coupon_restrictions'
}

Expand Down Expand Up @@ -113,6 +115,7 @@ class Coupon(object):
'discount_type',
'exclude_mid_period_allocations',
'apply_on_cancel_at_end_of_period',
'apply_on_subscription_expiration',
'coupon_restrictions',
]

Expand Down Expand Up @@ -159,6 +162,7 @@ def __init__(self,
discount_type=APIHelper.SKIP,
exclude_mid_period_allocations=APIHelper.SKIP,
apply_on_cancel_at_end_of_period=APIHelper.SKIP,
apply_on_subscription_expiration=APIHelper.SKIP,
coupon_restrictions=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the Coupon class"""
Expand Down Expand Up @@ -220,6 +224,8 @@ def __init__(self,
self.exclude_mid_period_allocations = exclude_mid_period_allocations
if apply_on_cancel_at_end_of_period is not APIHelper.SKIP:
self.apply_on_cancel_at_end_of_period = apply_on_cancel_at_end_of_period
if apply_on_subscription_expiration is not APIHelper.SKIP:
self.apply_on_subscription_expiration = apply_on_subscription_expiration
if coupon_restrictions is not APIHelper.SKIP:
self.coupon_restrictions = coupon_restrictions

Expand Down Expand Up @@ -280,6 +286,7 @@ def from_dictionary(cls,
discount_type = dictionary.get("discount_type") if dictionary.get("discount_type") else APIHelper.SKIP
exclude_mid_period_allocations = dictionary.get("exclude_mid_period_allocations") if "exclude_mid_period_allocations" in dictionary.keys() else APIHelper.SKIP
apply_on_cancel_at_end_of_period = dictionary.get("apply_on_cancel_at_end_of_period") if "apply_on_cancel_at_end_of_period" in dictionary.keys() else APIHelper.SKIP
apply_on_subscription_expiration = dictionary.get("apply_on_subscription_expiration") if "apply_on_subscription_expiration" in dictionary.keys() else APIHelper.SKIP
coupon_restrictions = None
if dictionary.get('coupon_restrictions') is not None:
coupon_restrictions = [CouponRestriction.from_dictionary(x) for x in dictionary.get('coupon_restrictions')]
Expand Down Expand Up @@ -318,5 +325,6 @@ def from_dictionary(cls,
discount_type,
exclude_mid_period_allocations,
apply_on_cancel_at_end_of_period,
apply_on_subscription_expiration,
coupon_restrictions,
dictionary)
10 changes: 9 additions & 1 deletion advancedbilling/models/create_or_update_flat_amount_coupon.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CreateOrUpdateFlatAmountCoupon(object):
here.
exclude_mid_period_allocations (bool): TODO: type description here.
apply_on_cancel_at_end_of_period (bool): TODO: type description here.
apply_on_subscription_expiration (bool): TODO: type description here.

"""

Expand All @@ -47,7 +48,8 @@ class CreateOrUpdateFlatAmountCoupon(object):
"stackable": 'stackable',
"compounding_strategy": 'compounding_strategy',
"exclude_mid_period_allocations": 'exclude_mid_period_allocations',
"apply_on_cancel_at_end_of_period": 'apply_on_cancel_at_end_of_period'
"apply_on_cancel_at_end_of_period": 'apply_on_cancel_at_end_of_period',
"apply_on_subscription_expiration": 'apply_on_subscription_expiration'
}

_optionals = [
Expand All @@ -60,6 +62,7 @@ class CreateOrUpdateFlatAmountCoupon(object):
'compounding_strategy',
'exclude_mid_period_allocations',
'apply_on_cancel_at_end_of_period',
'apply_on_subscription_expiration',
]

def __init__(self,
Expand All @@ -75,6 +78,7 @@ def __init__(self,
compounding_strategy=APIHelper.SKIP,
exclude_mid_period_allocations=APIHelper.SKIP,
apply_on_cancel_at_end_of_period=APIHelper.SKIP,
apply_on_subscription_expiration=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the CreateOrUpdateFlatAmountCoupon class"""

Expand All @@ -100,6 +104,8 @@ def __init__(self,
self.exclude_mid_period_allocations = exclude_mid_period_allocations
if apply_on_cancel_at_end_of_period is not APIHelper.SKIP:
self.apply_on_cancel_at_end_of_period = apply_on_cancel_at_end_of_period
if apply_on_subscription_expiration is not APIHelper.SKIP:
self.apply_on_subscription_expiration = apply_on_subscription_expiration

# Add additional model properties to the instance
self.additional_properties = additional_properties
Expand Down Expand Up @@ -135,6 +141,7 @@ def from_dictionary(cls,
compounding_strategy = dictionary.get("compounding_strategy") if dictionary.get("compounding_strategy") else APIHelper.SKIP
exclude_mid_period_allocations = dictionary.get("exclude_mid_period_allocations") if "exclude_mid_period_allocations" in dictionary.keys() else APIHelper.SKIP
apply_on_cancel_at_end_of_period = dictionary.get("apply_on_cancel_at_end_of_period") if "apply_on_cancel_at_end_of_period" in dictionary.keys() else APIHelper.SKIP
apply_on_subscription_expiration = dictionary.get("apply_on_subscription_expiration") if "apply_on_subscription_expiration" in dictionary.keys() else APIHelper.SKIP
# Clean out expected properties from dictionary
for key in cls._names.values():
if key in dictionary:
Expand All @@ -152,6 +159,7 @@ def from_dictionary(cls,
compounding_strategy,
exclude_mid_period_allocations,
apply_on_cancel_at_end_of_period,
apply_on_subscription_expiration,
dictionary)

@classmethod
Expand Down
10 changes: 9 additions & 1 deletion advancedbilling/models/create_or_update_percentage_coupon.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CreateOrUpdatePercentageCoupon(object):
here.
exclude_mid_period_allocations (bool): TODO: type description here.
apply_on_cancel_at_end_of_period (bool): TODO: type description here.
apply_on_subscription_expiration (bool): TODO: type description here.

"""

Expand All @@ -47,7 +48,8 @@ class CreateOrUpdatePercentageCoupon(object):
"stackable": 'stackable',
"compounding_strategy": 'compounding_strategy',
"exclude_mid_period_allocations": 'exclude_mid_period_allocations',
"apply_on_cancel_at_end_of_period": 'apply_on_cancel_at_end_of_period'
"apply_on_cancel_at_end_of_period": 'apply_on_cancel_at_end_of_period',
"apply_on_subscription_expiration": 'apply_on_subscription_expiration'
}

_optionals = [
Expand All @@ -60,6 +62,7 @@ class CreateOrUpdatePercentageCoupon(object):
'compounding_strategy',
'exclude_mid_period_allocations',
'apply_on_cancel_at_end_of_period',
'apply_on_subscription_expiration',
]

def __init__(self,
Expand All @@ -75,6 +78,7 @@ def __init__(self,
compounding_strategy=APIHelper.SKIP,
exclude_mid_period_allocations=APIHelper.SKIP,
apply_on_cancel_at_end_of_period=APIHelper.SKIP,
apply_on_subscription_expiration=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the CreateOrUpdatePercentageCoupon class"""

Expand All @@ -100,6 +104,8 @@ def __init__(self,
self.exclude_mid_period_allocations = exclude_mid_period_allocations
if apply_on_cancel_at_end_of_period is not APIHelper.SKIP:
self.apply_on_cancel_at_end_of_period = apply_on_cancel_at_end_of_period
if apply_on_subscription_expiration is not APIHelper.SKIP:
self.apply_on_subscription_expiration = apply_on_subscription_expiration

# Add additional model properties to the instance
self.additional_properties = additional_properties
Expand Down Expand Up @@ -136,6 +142,7 @@ def from_dictionary(cls,
compounding_strategy = dictionary.get("compounding_strategy") if dictionary.get("compounding_strategy") else APIHelper.SKIP
exclude_mid_period_allocations = dictionary.get("exclude_mid_period_allocations") if "exclude_mid_period_allocations" in dictionary.keys() else APIHelper.SKIP
apply_on_cancel_at_end_of_period = dictionary.get("apply_on_cancel_at_end_of_period") if "apply_on_cancel_at_end_of_period" in dictionary.keys() else APIHelper.SKIP
apply_on_subscription_expiration = dictionary.get("apply_on_subscription_expiration") if "apply_on_subscription_expiration" in dictionary.keys() else APIHelper.SKIP
# Clean out expected properties from dictionary
for key in cls._names.values():
if key in dictionary:
Expand All @@ -153,6 +160,7 @@ def from_dictionary(cls,
compounding_strategy,
exclude_mid_period_allocations,
apply_on_cancel_at_end_of_period,
apply_on_subscription_expiration,
dictionary)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions doc/models/coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| `discount_type` | [`DiscountType`](../../doc/models/discount-type.md) | Optional | - |
| `exclude_mid_period_allocations` | `bool` | Optional | - |
| `apply_on_cancel_at_end_of_period` | `bool` | Optional | - |
| `apply_on_subscription_expiration` | `bool` | Optional | - |
| `coupon_restrictions` | [`List[CouponRestriction]`](../../doc/models/coupon-restriction.md) | Optional | - |

## Example (as JSON)
Expand Down
1 change: 1 addition & 0 deletions doc/models/create-or-update-flat-amount-coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
| `compounding_strategy` | [`CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | - |
| `exclude_mid_period_allocations` | `bool` | Optional | - |
| `apply_on_cancel_at_end_of_period` | `bool` | Optional | - |
| `apply_on_subscription_expiration` | `bool` | Optional | - |

## Example (as JSON)

Expand Down
1 change: 1 addition & 0 deletions doc/models/create-or-update-percentage-coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
| `compounding_strategy` | [`CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | - |
| `exclude_mid_period_allocations` | `bool` | Optional | - |
| `apply_on_cancel_at_end_of_period` | `bool` | Optional | - |
| `apply_on_subscription_expiration` | `bool` | Optional | - |

## Example (as JSON)

Expand Down
Loading