order.proto 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.commerce.consumer.procurement.v1alpha1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/commerce/consumer/procurement/v1alpha1;procurement";
  20. option java_multiple_files = true;
  21. option java_package = "com.google.cloud.commerce.consumer.procurement.v1alpha1";
  22. option (google.api.resource_definition) = {
  23. type: "commerceoffercatalog.googleapis.com/Offer"
  24. pattern: "services/{service}/standardOffers/{offer}"
  25. pattern: "billingAccounts/{consumer_billing_account}/offers/{offer}"
  26. };
  27. // Represents a purchase made by a customer on Cloud Marketplace.
  28. // Creating an order makes sure that both the Google backend systems
  29. // as well as external service provider's systems (if needed) allow use of
  30. // purchased products and ensures the appropriate billing events occur.
  31. //
  32. // An Order can be made against one Product with multiple add-ons (optional) or
  33. // one Quote which might reference multiple products.
  34. //
  35. // Customers typically choose a price plan for each Product purchased when
  36. // they create an order and can change their plan later, if the product allows.
  37. message Order {
  38. option (google.api.resource) = {
  39. type: "cloudcommerceconsumerprocurement.googleapis.com/Order"
  40. pattern: "billingAccounts/{billing_account}/orders/{order}"
  41. };
  42. // Output only. The resource name of the order.
  43. // Has the form
  44. // `billingAccounts/{billing_account}/orders/{order}`.
  45. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  46. // Required. The user-specified name of the order.
  47. // Must be unique within a billing account.
  48. string display_name = 10 [(google.api.field_behavior) = REQUIRED];
  49. // Output only. The items being purchased.
  50. repeated LineItem line_items = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  51. // Output only. Line items that were cancelled.
  52. repeated LineItem cancelled_line_items = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  53. // Output only. The creation timestamp.
  54. google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  55. // Output only. The last update timestamp.
  56. google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  57. // The weak etag of the order.
  58. string etag = 11;
  59. }
  60. // A single item within an order.
  61. message LineItem {
  62. // Output only. Line item ID.
  63. string line_item_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  64. // Output only. Current state and information of this item. It tells what,
  65. // e.g. which offer, is currently effective.
  66. LineItemInfo line_item_info = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  67. // Output only. A change made on the item which is pending and not yet
  68. // effective. Absence of this field indicates the line item is not undergoing
  69. // a change.
  70. LineItemChange pending_change = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  71. // Output only. Changes made on the item that are not pending anymore which might be
  72. // because they already took effect, were reverted by the customer, or were
  73. // rejected by the partner. No more operations are allowed on these changes.
  74. repeated LineItemChange change_history = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  75. }
  76. // A change made on a line item.
  77. message LineItemChange {
  78. // Output only. Change ID.
  79. // All changes made within one order update operation have the same change_id.
  80. string change_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  81. // Required. Type of the change to make.
  82. LineItemChangeType change_type = 2 [(google.api.field_behavior) = REQUIRED];
  83. // Output only. Line item info before the change.
  84. LineItemInfo old_line_item_info = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  85. // Line item info after the change.
  86. LineItemInfo new_line_item_info = 4;
  87. // Output only. State of the change.
  88. LineItemChangeState change_state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  89. // Output only. Provider-supplied message explaining the LineItemChange's
  90. // state. Mainly used to communicate progress and ETA for provisioning in the
  91. // case of `PENDING_APPROVAL`, and to explain why the change request was
  92. // denied or canceled in the case of `REJECTED` and `CANCELED` states.
  93. string state_reason = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  94. // Output only. Predefined enum types for why this line item change is in current state.
  95. // For example, a line item change's state could be
  96. // `LINE_ITEM_CHANGE_STATE_COMPLETED` because of end-of-term expiration,
  97. // immediate cancellation initiated by the user, or system-initiated
  98. // cancellation.
  99. LineItemChangeStateReasonType change_state_reason_type = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  100. // Output only. A time at which the change became or will become (in case of
  101. // pending change) effective.
  102. google.protobuf.Timestamp change_effective_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  103. // Output only. The time when change was initiated.
  104. google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  105. // Output only. The time when change was updated, e.g. approved/rejected by
  106. // partners or cancelled by the user.
  107. google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  108. }
  109. // Line item information.
  110. message LineItemInfo {
  111. // Optional. The name of the offer can have either of these formats:
  112. // 'billingAccounts/{billing_account}/offers/{offer}',
  113. // or 'services/{service}/standardOffers/{offer}'.
  114. string offer = 13 [
  115. (google.api.field_behavior) = OPTIONAL,
  116. (google.api.resource_reference) = {
  117. type: "commerceoffercatalog.googleapis.com/Offer"
  118. }
  119. ];
  120. // Optional. User-provided parameters.
  121. repeated Parameter parameters = 9 [(google.api.field_behavior) = OPTIONAL];
  122. // Output only. Information about the subscription created, if applicable.
  123. Subscription subscription = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  124. }
  125. // User-provided Parameters.
  126. message Parameter {
  127. message Value {
  128. // The kind of value.
  129. oneof kind {
  130. // Represents an int64 value.
  131. int64 int64_value = 3;
  132. // Represents a string value.
  133. string string_value = 4;
  134. // Represents a double value.
  135. double double_value = 5;
  136. }
  137. }
  138. // Name of the parameter.
  139. string name = 1;
  140. // Value of parameter.
  141. Value value = 2;
  142. }
  143. // Type of a line item change.
  144. enum LineItemChangeType {
  145. // Sentinel value. Do not use.
  146. LINE_ITEM_CHANGE_TYPE_UNSPECIFIED = 0;
  147. // The change is to create a new line item.
  148. LINE_ITEM_CHANGE_TYPE_CREATE = 1;
  149. // The change is to update an existing line item.
  150. LINE_ITEM_CHANGE_TYPE_UPDATE = 2;
  151. // The change is to cancel an existing line item.
  152. LINE_ITEM_CHANGE_TYPE_CANCEL = 3;
  153. // The change is to revert a cancellation.
  154. LINE_ITEM_CHANGE_TYPE_REVERT_CANCELLATION = 4;
  155. }
  156. // State of a change.
  157. enum LineItemChangeState {
  158. // Sentinel value. Do not use.
  159. LINE_ITEM_CHANGE_STATE_UNSPECIFIED = 0;
  160. // Change is in this state when a change is initiated and waiting for
  161. // partner approval.
  162. LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL = 1;
  163. // Change is in this state after it's approved by the partner or auto-approved
  164. // but before it takes effect. The change can be overwritten
  165. // or cancelled depending on the new line item info property (pending Private
  166. // Offer change cannot be cancelled and can only be overwritten by another
  167. // Private Offer).
  168. LINE_ITEM_CHANGE_STATE_APPROVED = 2;
  169. // Change is in this state after it's been activated.
  170. LINE_ITEM_CHANGE_STATE_COMPLETED = 3;
  171. // Change is in this state if it was rejected by the partner.
  172. LINE_ITEM_CHANGE_STATE_REJECTED = 4;
  173. // Change is in this state if it was abandoned by the user.
  174. LINE_ITEM_CHANGE_STATE_ABANDONED = 5;
  175. // Change is in this state if it's currently being provisioned downstream. The
  176. // change can't be overwritten or cancelled when it's in this state.
  177. LINE_ITEM_CHANGE_STATE_ACTIVATING = 6;
  178. }
  179. // Predefined types for line item change state reason.
  180. enum LineItemChangeStateReasonType {
  181. // Default value, indicating there's no predefined type for change state
  182. // reason.
  183. LINE_ITEM_CHANGE_STATE_REASON_TYPE_UNSPECIFIED = 0;
  184. // Change is in current state due to term expiration.
  185. LINE_ITEM_CHANGE_STATE_REASON_TYPE_EXPIRED = 1;
  186. // Change is in current state due to user-initiated cancellation.
  187. LINE_ITEM_CHANGE_STATE_REASON_TYPE_USER_CANCELLED = 2;
  188. // Change is in current state due to system-initiated cancellation.
  189. LINE_ITEM_CHANGE_STATE_REASON_TYPE_SYSTEM_CANCELLED = 3;
  190. }
  191. // Subscription information.
  192. message Subscription {
  193. // The timestamp when the subscription begins, if applicable.
  194. google.protobuf.Timestamp start_time = 3;
  195. // The timestamp when the subscription ends, if applicable.
  196. google.protobuf.Timestamp end_time = 1;
  197. // Whether auto renewal is enabled by user choice on current subscription.
  198. // This field indicates order/subscription status after pending plan change is
  199. // cancelled or rejected.
  200. bool auto_renewal_enabled = 2;
  201. }