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.
@@ -2022,6 +2022,128 @@ class Api extends HttpClient {
2022
2022
  ...params,
2023
2023
  }),
2024
2024
  };
2025
+ orderForms = {
2026
+ /**
2027
+ * @description This endpoint is used to list all existing order forms. This is a premium feature.
2028
+ *
2029
+ * @tags order_forms
2030
+ * @name FindAllOrderForms
2031
+ * @summary List all order forms
2032
+ * @request GET:/order_forms
2033
+ * @secure
2034
+ */
2035
+ findAllOrderForms: (query, params = {}) => this.request({
2036
+ path: `/order_forms`,
2037
+ method: "GET",
2038
+ query: query,
2039
+ secure: true,
2040
+ format: "json",
2041
+ ...params,
2042
+ }),
2043
+ /**
2044
+ * @description This endpoint retrieves a specific order form. This is a premium feature.
2045
+ *
2046
+ * @tags order_forms
2047
+ * @name FindOrderForm
2048
+ * @summary Retrieve an order form
2049
+ * @request GET:/order_forms/{lago_id}
2050
+ * @secure
2051
+ */
2052
+ findOrderForm: (lagoId, params = {}) => this.request({
2053
+ path: `/order_forms/${lagoId}`,
2054
+ method: "GET",
2055
+ secure: true,
2056
+ format: "json",
2057
+ ...params,
2058
+ }),
2059
+ /**
2060
+ * @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.
2061
+ *
2062
+ * @tags order_forms
2063
+ * @name MarkOrderFormAsSigned
2064
+ * @summary Mark an order form as signed
2065
+ * @request POST:/order_forms/{lago_id}/mark_as_signed
2066
+ * @secure
2067
+ */
2068
+ markOrderFormAsSigned: (lagoId, data, params = {}) => this.request({
2069
+ path: `/order_forms/${lagoId}/mark_as_signed`,
2070
+ method: "POST",
2071
+ body: data,
2072
+ secure: true,
2073
+ type: ContentType.Json,
2074
+ format: "json",
2075
+ ...params,
2076
+ }),
2077
+ /**
2078
+ * @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.
2079
+ *
2080
+ * @tags order_forms
2081
+ * @name VoidOrderForm
2082
+ * @summary Void an order form
2083
+ * @request POST:/order_forms/{lago_id}/void
2084
+ * @secure
2085
+ */
2086
+ voidOrderForm: (lagoId, params = {}) => this.request({
2087
+ path: `/order_forms/${lagoId}/void`,
2088
+ method: "POST",
2089
+ secure: true,
2090
+ format: "json",
2091
+ ...params,
2092
+ }),
2093
+ };
2094
+ orders = {
2095
+ /**
2096
+ * @description This endpoint is used to list all existing orders. This is a premium feature.
2097
+ *
2098
+ * @tags orders
2099
+ * @name FindAllOrders
2100
+ * @summary List all orders
2101
+ * @request GET:/orders
2102
+ * @secure
2103
+ */
2104
+ findAllOrders: (query, params = {}) => this.request({
2105
+ path: `/orders`,
2106
+ method: "GET",
2107
+ query: query,
2108
+ secure: true,
2109
+ format: "json",
2110
+ ...params,
2111
+ }),
2112
+ /**
2113
+ * @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.
2114
+ *
2115
+ * @tags orders
2116
+ * @name FindOrder
2117
+ * @summary Retrieve an order
2118
+ * @request GET:/orders/{lago_id}
2119
+ * @secure
2120
+ */
2121
+ findOrder: (lagoId, params = {}) => this.request({
2122
+ path: `/orders/${lagoId}`,
2123
+ method: "GET",
2124
+ secure: true,
2125
+ format: "json",
2126
+ ...params,
2127
+ }),
2128
+ /**
2129
+ * @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.
2130
+ *
2131
+ * @tags orders
2132
+ * @name ExecuteOrder
2133
+ * @summary Execute an order
2134
+ * @request POST:/orders/{lago_id}/execute
2135
+ * @secure
2136
+ */
2137
+ executeOrder: (lagoId, data, params = {}) => this.request({
2138
+ path: `/orders/${lagoId}/execute`,
2139
+ method: "POST",
2140
+ body: data,
2141
+ secure: true,
2142
+ type: ContentType.Json,
2143
+ format: "json",
2144
+ ...params,
2145
+ }),
2146
+ };
2025
2147
  organizations = {
2026
2148
  /**
2027
2149
  * @description This endpoint is used to update your own organization's settings.
@@ -2699,6 +2821,126 @@ class Api extends HttpClient {
2699
2821
  ...params,
2700
2822
  }),
2701
2823
  };
2824
+ quotes = {
2825
+ /**
2826
+ * @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.
2827
+ *
2828
+ * @tags quotes
2829
+ * @name FindAllQuotes
2830
+ * @summary List all quotes
2831
+ * @request GET:/quotes
2832
+ * @secure
2833
+ */
2834
+ findAllQuotes: (query, params = {}) => this.request({
2835
+ path: `/quotes`,
2836
+ method: "GET",
2837
+ query: query,
2838
+ secure: true,
2839
+ format: "json",
2840
+ ...params,
2841
+ }),
2842
+ /**
2843
+ * @description This endpoint retrieves a specific quote, along with its owners and its current version. This is a premium feature.
2844
+ *
2845
+ * @tags quotes
2846
+ * @name FindQuote
2847
+ * @summary Retrieve a quote
2848
+ * @request GET:/quotes/{lago_id}
2849
+ * @secure
2850
+ */
2851
+ findQuote: (lagoId, params = {}) => this.request({
2852
+ path: `/quotes/${lagoId}`,
2853
+ method: "GET",
2854
+ secure: true,
2855
+ format: "json",
2856
+ ...params,
2857
+ }),
2858
+ /**
2859
+ * @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.
2860
+ *
2861
+ * @tags quotes
2862
+ * @name FindAllQuoteVersions
2863
+ * @summary List all versions of a quote
2864
+ * @request GET:/quotes/{lago_id}/versions
2865
+ * @secure
2866
+ */
2867
+ findAllQuoteVersions: (lagoId, query, params = {}) => this.request({
2868
+ path: `/quotes/${lagoId}/versions`,
2869
+ method: "GET",
2870
+ query: query,
2871
+ secure: true,
2872
+ format: "json",
2873
+ ...params,
2874
+ }),
2875
+ };
2876
+ quoteVersions = {
2877
+ /**
2878
+ * @description This endpoint retrieves a specific quote version, along with its document `content` and its `billing_items`. This is a premium feature.
2879
+ *
2880
+ * @tags quotes
2881
+ * @name FindQuoteVersion
2882
+ * @summary Retrieve a quote version
2883
+ * @request GET:/quote_versions/{lago_id}
2884
+ * @secure
2885
+ */
2886
+ findQuoteVersion: (lagoId, params = {}) => this.request({
2887
+ path: `/quote_versions/${lagoId}`,
2888
+ method: "GET",
2889
+ secure: true,
2890
+ format: "json",
2891
+ ...params,
2892
+ }),
2893
+ /**
2894
+ * @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.
2895
+ *
2896
+ * @tags quotes
2897
+ * @name ApproveQuoteVersion
2898
+ * @summary Approve a quote version
2899
+ * @request POST:/quote_versions/{lago_id}/approve
2900
+ * @secure
2901
+ */
2902
+ approveQuoteVersion: (lagoId, data, params = {}) => this.request({
2903
+ path: `/quote_versions/${lagoId}/approve`,
2904
+ method: "POST",
2905
+ body: data,
2906
+ secure: true,
2907
+ type: ContentType.Json,
2908
+ format: "json",
2909
+ ...params,
2910
+ }),
2911
+ /**
2912
+ * @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.
2913
+ *
2914
+ * @tags quotes
2915
+ * @name VoidQuoteVersion
2916
+ * @summary Void a quote version
2917
+ * @request POST:/quote_versions/{lago_id}/void
2918
+ * @secure
2919
+ */
2920
+ voidQuoteVersion: (lagoId, params = {}) => this.request({
2921
+ path: `/quote_versions/${lagoId}/void`,
2922
+ method: "POST",
2923
+ secure: true,
2924
+ format: "json",
2925
+ ...params,
2926
+ }),
2927
+ /**
2928
+ * @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.
2929
+ *
2930
+ * @tags quotes
2931
+ * @name CloneQuoteVersion
2932
+ * @summary Clone a quote version
2933
+ * @request POST:/quote_versions/{lago_id}/clone
2934
+ * @secure
2935
+ */
2936
+ cloneQuoteVersion: (lagoId, params = {}) => this.request({
2937
+ path: `/quote_versions/${lagoId}/clone`,
2938
+ method: "POST",
2939
+ secure: true,
2940
+ format: "json",
2941
+ ...params,
2942
+ }),
2943
+ };
2702
2944
  subscriptions = {
2703
2945
  /**
2704
2946
  * @description This endpoint assigns a plan to a customer, creating or modifying a subscription. Ideal for initial subscriptions or plan changes (upgrades/downgrades).