Skip to content

Commit

Permalink
Open api spec changes for coupon (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadaismail-stripe authored Nov 15, 2022
1 parent 691672e commit 72bd11a
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 2 deletions.
93 changes: 93 additions & 0 deletions public/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1514,5 +1514,98 @@
}
]
}
],
"formattedStripeCouponFields": [
{
"label": "Standard Mappings",
"name": "standard",
"description": "",
"fields": [
{
"name": "amount off",
"value": "amount_off",
"description": "<p>A positive integer representing the amount to subtract from an invoice total (required if <code>percent_off</code> is not passed).</p>",
"type": "integer",
"defaultValue": "",
"requiredValue": "",
"hasOverride": false,
"staticValue": false,
"hasSfValue": false,
"hasRequiredValue": false,
"sfValue": "",
"sfValueType": ""
},
{
"name": "duration",
"value": "duration",
"description": "<p>Specifies how long the discount will be in effect if used on a subscription. Can be <code>forever</code>, <code>once</code>, or <code>repeating</code>. Defaults to <code>once</code>.</p>",
"type": "string",
"defaultValue": "",
"requiredValue": "",
"hasOverride": false,
"staticValue": false,
"hasSfValue": false,
"hasRequiredValue": false,
"sfValue": "",
"sfValueType": ""
},
{
"name": "duration in months",
"value": "duration_in_months",
"description": "<p>Required only if <code>duration</code> is <code>repeating</code>, in which case it must be a positive integer that specifies the number of months the discount will be in effect.</p>",
"type": "integer",
"defaultValue": "",
"requiredValue": "",
"hasOverride": false,
"staticValue": false,
"hasSfValue": false,
"hasRequiredValue": false,
"sfValue": "",
"sfValueType": ""
},
{
"name": "max redemptions",
"value": "max_redemptions",
"description": "<p>A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid. For example, you might have a 50% off coupon that the first 20 readers of your blog can use.</p>",
"type": "integer",
"defaultValue": "",
"requiredValue": "",
"hasOverride": false,
"staticValue": false,
"hasSfValue": false,
"hasRequiredValue": false,
"sfValue": "",
"sfValueType": ""
},
{
"name": "name",
"value": "name",
"description": "<p>Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the <code>id</code> is shown if <code>name</code> is not set.</p>",
"type": "string",
"defaultValue": "",
"requiredValue": "",
"hasOverride": false,
"staticValue": false,
"hasSfValue": false,
"hasRequiredValue": false,
"sfValue": "",
"sfValueType": ""
},
{
"name": "percent off",
"value": "percent_off",
"description": "<p>A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if <code>amount_off</code> is not passed).</p>",
"type": "number",
"defaultValue": "",
"requiredValue": "",
"hasOverride": false,
"staticValue": false,
"hasSfValue": false,
"hasRequiredValue": false,
"sfValue": "",
"sfValueType": ""
}
]
}
]
}
9 changes: 7 additions & 2 deletions sfdx/bin/openapi-spec-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const excludedFields = {
product: [
// not essential to exclude the ID, but not using a standard ID makes maintaining an account confusing
'id',

'price'
],

Expand Down Expand Up @@ -43,7 +42,12 @@ const excludedFields = {
'product_data'
],

subscription_schedule_phase: []
subscription_schedule_phase: [],
coupon: [
'id',
'currency',
'redeem_by'
]
}

const ListOfStripeObjects = [
Expand All @@ -52,6 +56,7 @@ const ListOfStripeObjects = [
'subscription_schedule',
'subscription_item',
'price',
'coupon'
]

const OPTIONS = {
Expand Down

0 comments on commit 72bd11a

Please sign in to comment.