lago-javascript-client 1.52.0 → 1.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2018,6 +2018,128 @@ export class Api extends HttpClient {
2018
2018
  ...params,
2019
2019
  }),
2020
2020
  };
2021
+ orderForms = {
2022
+ /**
2023
+ * @description This endpoint is used to list all existing order forms. This is a premium feature.
2024
+ *
2025
+ * @tags order_forms
2026
+ * @name FindAllOrderForms
2027
+ * @summary List all order forms
2028
+ * @request GET:/order_forms
2029
+ * @secure
2030
+ */
2031
+ findAllOrderForms: (query, params = {}) => this.request({
2032
+ path: `/order_forms`,
2033
+ method: "GET",
2034
+ query: query,
2035
+ secure: true,
2036
+ format: "json",
2037
+ ...params,
2038
+ }),
2039
+ /**
2040
+ * @description This endpoint retrieves a specific order form. This is a premium feature.
2041
+ *
2042
+ * @tags order_forms
2043
+ * @name FindOrderForm
2044
+ * @summary Retrieve an order form
2045
+ * @request GET:/order_forms/{lago_id}
2046
+ * @secure
2047
+ */
2048
+ findOrderForm: (lagoId, params = {}) => this.request({
2049
+ path: `/order_forms/${lagoId}`,
2050
+ method: "GET",
2051
+ secure: true,
2052
+ format: "json",
2053
+ ...params,
2054
+ }),
2055
+ /**
2056
+ * @description This endpoint records the customer's signature on an order form, and creates the order that carries the quoted deal out. Only a `generated` order form can be signed, so a `422` is returned once the order form has been signed, has expired or has been voided. An `execute_at` landing on or after the day the quoted deal stops being executable is rejected as well, so the order can never be scheduled past the term it bills. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2057
+ *
2058
+ * @tags order_forms
2059
+ * @name MarkOrderFormAsSigned
2060
+ * @summary Mark an order form as signed
2061
+ * @request POST:/order_forms/{lago_id}/mark_as_signed
2062
+ * @secure
2063
+ */
2064
+ markOrderFormAsSigned: (lagoId, data, params = {}) => this.request({
2065
+ path: `/order_forms/${lagoId}/mark_as_signed`,
2066
+ method: "POST",
2067
+ body: data,
2068
+ secure: true,
2069
+ type: ContentType.Json,
2070
+ format: "json",
2071
+ ...params,
2072
+ }),
2073
+ /**
2074
+ * @description This endpoint voids an order form, with the `manual` reason, and cascades to the quote version it was generated from, which is voided with the `cascade_of_voided` reason. Only a `generated` order form can be voided, so a `422` is returned once the order form has been signed, has expired or has already been voided. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2075
+ *
2076
+ * @tags order_forms
2077
+ * @name VoidOrderForm
2078
+ * @summary Void an order form
2079
+ * @request POST:/order_forms/{lago_id}/void
2080
+ * @secure
2081
+ */
2082
+ voidOrderForm: (lagoId, params = {}) => this.request({
2083
+ path: `/order_forms/${lagoId}/void`,
2084
+ method: "POST",
2085
+ secure: true,
2086
+ format: "json",
2087
+ ...params,
2088
+ }),
2089
+ };
2090
+ orders = {
2091
+ /**
2092
+ * @description This endpoint is used to list all existing orders. This is a premium feature.
2093
+ *
2094
+ * @tags orders
2095
+ * @name FindAllOrders
2096
+ * @summary List all orders
2097
+ * @request GET:/orders
2098
+ * @secure
2099
+ */
2100
+ findAllOrders: (query, params = {}) => this.request({
2101
+ path: `/orders`,
2102
+ method: "GET",
2103
+ query: query,
2104
+ secure: true,
2105
+ format: "json",
2106
+ ...params,
2107
+ }),
2108
+ /**
2109
+ * @description This endpoint retrieves a specific order, along with the `billing_snapshot` its execution applies and the `execution_record` of what it produced. This is a premium feature.
2110
+ *
2111
+ * @tags orders
2112
+ * @name FindOrder
2113
+ * @summary Retrieve an order
2114
+ * @request GET:/orders/{lago_id}
2115
+ * @secure
2116
+ */
2117
+ findOrder: (lagoId, params = {}) => this.request({
2118
+ path: `/orders/${lagoId}`,
2119
+ method: "GET",
2120
+ secure: true,
2121
+ format: "json",
2122
+ ...params,
2123
+ }),
2124
+ /**
2125
+ * @description This endpoint carries out an order on demand, without waiting for its `execute_at` schedule. It runs synchronously, so the response carries the resulting status and, when the execution fails, the reason it failed. An `execute_in_lago` order applies the quoted deal, creating the subscriptions, coupons, wallets or one-off invoice it describes; an `order_only` order is simply marked as executed. What the execution produced is listed in `execution_record`. Executing is idempotent: an order that has already been executed is returned untouched. An order whose previous execution failed is executed again, and a `422` is returned when the order carries no execution mode and none is provided in the body. Restating an `execution_mode` that differs from the one stored on the order updates it first, which only succeeds while the order is still `created`: a `failed` order can be retried, but not switched to another mode. That update also re-validates the order's own `execute_at` against the day the quoted deal stops being executable, so a `422` is possible even though no date was sent. An order carrying no `execute_at` is not bounded that way, and a deal whose term has passed then only fails when the execution runs. A `404` is not limited to an unknown order: when the execution cannot find a catalog record the quote pinned, such as a deleted plan, charge, coupon or the subscription being amended, the missing resource is reported as a `404` and the order is left `failed`. Concurrency is reported two ways. A mode change losing the race on the quote comes back as a `422` validation error, while the execution itself losing it comes back as a `422` carrying a lock code, because a scheduled execution relies on that error to be retried. This is a premium feature.
2126
+ *
2127
+ * @tags orders
2128
+ * @name ExecuteOrder
2129
+ * @summary Execute an order
2130
+ * @request POST:/orders/{lago_id}/execute
2131
+ * @secure
2132
+ */
2133
+ executeOrder: (lagoId, data, params = {}) => this.request({
2134
+ path: `/orders/${lagoId}/execute`,
2135
+ method: "POST",
2136
+ body: data,
2137
+ secure: true,
2138
+ type: ContentType.Json,
2139
+ format: "json",
2140
+ ...params,
2141
+ }),
2142
+ };
2021
2143
  organizations = {
2022
2144
  /**
2023
2145
  * @description This endpoint is used to update your own organization's settings.
@@ -2695,6 +2817,126 @@ export class Api extends HttpClient {
2695
2817
  ...params,
2696
2818
  }),
2697
2819
  };
2820
+ quotes = {
2821
+ /**
2822
+ * @description This endpoint is used to list all existing quotes. Quotes are ordered by creation date, from the most recent to the oldest. This is a premium feature.
2823
+ *
2824
+ * @tags quotes
2825
+ * @name FindAllQuotes
2826
+ * @summary List all quotes
2827
+ * @request GET:/quotes
2828
+ * @secure
2829
+ */
2830
+ findAllQuotes: (query, params = {}) => this.request({
2831
+ path: `/quotes`,
2832
+ method: "GET",
2833
+ query: query,
2834
+ secure: true,
2835
+ format: "json",
2836
+ ...params,
2837
+ }),
2838
+ /**
2839
+ * @description This endpoint retrieves a specific quote, along with its owners and its current version. This is a premium feature.
2840
+ *
2841
+ * @tags quotes
2842
+ * @name FindQuote
2843
+ * @summary Retrieve a quote
2844
+ * @request GET:/quotes/{lago_id}
2845
+ * @secure
2846
+ */
2847
+ findQuote: (lagoId, params = {}) => this.request({
2848
+ path: `/quotes/${lagoId}`,
2849
+ method: "GET",
2850
+ secure: true,
2851
+ format: "json",
2852
+ ...params,
2853
+ }),
2854
+ /**
2855
+ * @description This endpoint is used to list all the versions of a specific quote, from the most recent to the oldest. The `content` and `billing_items` of each version are omitted; retrieve a version to get them. This is a premium feature.
2856
+ *
2857
+ * @tags quotes
2858
+ * @name FindAllQuoteVersions
2859
+ * @summary List all versions of a quote
2860
+ * @request GET:/quotes/{lago_id}/versions
2861
+ * @secure
2862
+ */
2863
+ findAllQuoteVersions: (lagoId, query, params = {}) => this.request({
2864
+ path: `/quotes/${lagoId}/versions`,
2865
+ method: "GET",
2866
+ query: query,
2867
+ secure: true,
2868
+ format: "json",
2869
+ ...params,
2870
+ }),
2871
+ };
2872
+ quoteVersions = {
2873
+ /**
2874
+ * @description This endpoint retrieves a specific quote version, along with its document `content` and its `billing_items`. This is a premium feature.
2875
+ *
2876
+ * @tags quotes
2877
+ * @name FindQuoteVersion
2878
+ * @summary Retrieve a quote version
2879
+ * @request GET:/quote_versions/{lago_id}
2880
+ * @secure
2881
+ */
2882
+ findQuoteVersion: (lagoId, params = {}) => this.request({
2883
+ path: `/quote_versions/${lagoId}`,
2884
+ method: "GET",
2885
+ secure: true,
2886
+ format: "json",
2887
+ ...params,
2888
+ }),
2889
+ /**
2890
+ * @description This endpoint approves a quote version and generates the order form to send to the customer for signature. Only a `draft` version can be approved, and its `billing_items` must be complete: approval validates them against the catalog and against the customer, and returns a `422` when the deal cannot be executed as quoted. The `expires_at` of the generated order form is bounded by the deal's own term, so a signing window reaching beyond the day the deal stops being executable is rejected. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2891
+ *
2892
+ * @tags quotes
2893
+ * @name ApproveQuoteVersion
2894
+ * @summary Approve a quote version
2895
+ * @request POST:/quote_versions/{lago_id}/approve
2896
+ * @secure
2897
+ */
2898
+ approveQuoteVersion: (lagoId, data, params = {}) => this.request({
2899
+ path: `/quote_versions/${lagoId}/approve`,
2900
+ method: "POST",
2901
+ body: data,
2902
+ secure: true,
2903
+ type: ContentType.Json,
2904
+ format: "json",
2905
+ ...params,
2906
+ }),
2907
+ /**
2908
+ * @description This endpoint voids a quote version, which makes it definitive: a voided version can neither be edited nor approved again. Only a `draft` version can be voided through this endpoint, and the resulting `void_reason` is `manual`. An `approved` version is voided by Lago itself, through the order form generated from it. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2909
+ *
2910
+ * @tags quotes
2911
+ * @name VoidQuoteVersion
2912
+ * @summary Void a quote version
2913
+ * @request POST:/quote_versions/{lago_id}/void
2914
+ * @secure
2915
+ */
2916
+ voidQuoteVersion: (lagoId, params = {}) => this.request({
2917
+ path: `/quote_versions/${lagoId}/void`,
2918
+ method: "POST",
2919
+ secure: true,
2920
+ format: "json",
2921
+ ...params,
2922
+ }),
2923
+ /**
2924
+ * @description This endpoint copies a quote version into a new `draft` version of the same quote, so that the deal can be renegotiated. Any version of the quote can be cloned, but a quote can only carry one active version: the draft the quote currently holds, if any, is voided with the `superseded` reason. Cloning is therefore rejected with a `422` once a version of the quote has been approved. A concurrent write on the same quote is reported as a `422` rather than retried, so a duplicated call can fail while the first one is still in flight. This is a premium feature.
2925
+ *
2926
+ * @tags quotes
2927
+ * @name CloneQuoteVersion
2928
+ * @summary Clone a quote version
2929
+ * @request POST:/quote_versions/{lago_id}/clone
2930
+ * @secure
2931
+ */
2932
+ cloneQuoteVersion: (lagoId, params = {}) => this.request({
2933
+ path: `/quote_versions/${lagoId}/clone`,
2934
+ method: "POST",
2935
+ secure: true,
2936
+ format: "json",
2937
+ ...params,
2938
+ }),
2939
+ };
2698
2940
  subscriptions = {
2699
2941
  /**
2700
2942
  * @description This endpoint assigns a plan to a customer, creating or modifying a subscription. Ideal for initial subscriptions or plan changes (upgrades/downgrades).