# All files / codegen/models Coupon.ts

73.85% Statements 113/153
100% Branches 0/0
0% Functions 0/3
73.85% Lines 113/153

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    1551x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x

    1x
    1x

    1x
    1x

     /* tslint:disable */
    /* eslint-disable */
    /**
     * Octane API
     * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
     *
     * The version of the OpenAPI document: 1.0.0
     *
     *
     * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
     * https://openapi-generator.tech
     * Do not edit the class manually.
     */

    import { exists, mapValues } from '../runtime';
    import {
        Customer1,
        Customer1FromJSON,
        Customer1FromJSONTyped,
        Customer1ToJSON,
    } from './Customer1';
    import {
        PricePlan1,
        PricePlan1FromJSON,
        PricePlan1FromJSONTyped,
        PricePlan1ToJSON,
    } from './PricePlan1';

    /**
     *
     * @export
     * @interface Coupon
     */
    export interface Coupon {
        /**
         * Unique name identifier.
         * @type {string}
         * @memberof Coupon
         */
        readonly name: string;
        /**
         * UI-friendly name used for data display. Defaults to `name`.
         * @type {string}
         * @memberof Coupon
         */
        displayName?: string;
        /**
         * The time when the coupon will stop being effective one its applied.
         * @type {number}
         * @memberof Coupon
         */
        durationLength?: number | null;
        /**
         * The unit time unit to apply to the specified duration length.
         * @type {string}
         * @memberof Coupon
         */
        durationUnit?: string | null;
        /**
         * ISO-8601 formatted timestamp that defines after what timestamp this coupon cannot be applied.
         * @type {Date}
         * @memberof Coupon
         */
        expirationTime?: Date | null;
        /**
         *
         * @type {any}
         * @memberof Coupon
         */
        readonly frequency?: any | null;
        /**
         * The maximum number of times this coupon can be used.
         * @type {number}
         * @memberof Coupon
         */
        maxUses?: number | null;
        /**
         * Customer facing code that can be used to apply coupon.
         * @type {string}
         * @memberof Coupon
         */
        code?: string | null;
        /**
         *
         * @type {any}
         * @memberof Coupon
         */
        readonly discountType?: any | null;
        /**
         * The amount of discount to give based on discount_type
         * @type {number}
         * @memberof Coupon
         */
        discountAmount: number;
        /**
         *
         * @type {Array<Customer1>}
         * @memberof Coupon
         */
        excludedCustomers?: Array<Customer1>;
        /**
         *
         * @type {Array<PricePlan1>}
         * @memberof Coupon
         */
        excludedPricePlans?: Array<PricePlan1>;
    }

    export function CouponFromJSON(json: any): Coupon {
        return CouponFromJSONTyped(json, false);
    }

    export function CouponFromJSONTyped(json: any, ignoreDiscriminator: boolean): Coupon {
        if ((json === undefined) || (json === null)) {
            return json;
        }
        return {

            'name': json['name'],
            'displayName': !exists(json, 'display_name') ? undefined : json['display_name'],
            'durationLength': !exists(json, 'duration_length') ? undefined : json['duration_length'],
            'durationUnit': !exists(json, 'duration_unit') ? undefined : json['duration_unit'],
            'expirationTime': !exists(json, 'expiration_time') ? undefined : (json['expiration_time'] === null ? null : new Date(json['expiration_time'])),
            'frequency': !exists(json, 'frequency') ? undefined : json['frequency'],
            'maxUses': !exists(json, 'max_uses') ? undefined : json['max_uses'],
            'code': !exists(json, 'code') ? undefined : json['code'],
            'discountType': !exists(json, 'discount_type') ? undefined : json['discount_type'],
            'discountAmount': json['discount_amount'],
            'excludedCustomers': !exists(json, 'excluded_customers') ? undefined : ((json['excluded_customers'] as Array<any>).map(Customer1FromJSON)),
            'excludedPricePlans': !exists(json, 'excluded_price_plans') ? undefined : ((json['excluded_price_plans'] as Array<any>).map(PricePlan1FromJSON)),
        };
    }

    export function CouponToJSON(value?: Coupon | null): any {
        if (value === undefined) {
            return undefined;
        }
        if (value === null) {
            return null;
        }
        return {

            'display_name': value.displayName,
            'duration_length': value.durationLength,
            'duration_unit': value.durationUnit,
            'expiration_time': value.expirationTime === undefined ? undefined : (value.expirationTime === null ? null : value.expirationTime.toISOString()),
            'max_uses': value.maxUses,
            'code': value.code,
            'discount_amount': value.discountAmount,
            'excluded_customers': value.excludedCustomers === undefined ? undefined : ((value.excludedCustomers as Array<any>).map(Customer1ToJSON)),
            'excluded_price_plans': value.excludedPricePlans === undefined ? undefined : ((value.excludedPricePlans as Array<any>).map(PricePlan1ToJSON)),
        };
    }