github.com/stripe/stripe-go/v76@v76.25.0/climate_order.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // Reason for the cancellation of this order.
    10  type ClimateOrderCancellationReason string
    11  
    12  // List of values that ClimateOrderCancellationReason can take
    13  const (
    14  	ClimateOrderCancellationReasonExpired            ClimateOrderCancellationReason = "expired"
    15  	ClimateOrderCancellationReasonProductUnavailable ClimateOrderCancellationReason = "product_unavailable"
    16  	ClimateOrderCancellationReasonRequested          ClimateOrderCancellationReason = "requested"
    17  )
    18  
    19  // The current status of this order.
    20  type ClimateOrderStatus string
    21  
    22  // List of values that ClimateOrderStatus can take
    23  const (
    24  	ClimateOrderStatusAwaitingFunds ClimateOrderStatus = "awaiting_funds"
    25  	ClimateOrderStatusCanceled      ClimateOrderStatus = "canceled"
    26  	ClimateOrderStatusConfirmed     ClimateOrderStatus = "confirmed"
    27  	ClimateOrderStatusDelivered     ClimateOrderStatus = "delivered"
    28  	ClimateOrderStatusOpen          ClimateOrderStatus = "open"
    29  )
    30  
    31  // Lists all Climate order objects. The orders are returned sorted by creation date, with the
    32  // most recently created orders appearing first.
    33  type ClimateOrderListParams struct {
    34  	ListParams `form:"*"`
    35  	// Specifies which fields in the response should be expanded.
    36  	Expand []*string `form:"expand"`
    37  }
    38  
    39  // AddExpand appends a new field to expand.
    40  func (p *ClimateOrderListParams) AddExpand(f string) {
    41  	p.Expand = append(p.Expand, &f)
    42  }
    43  
    44  // Publicly sharable reference for the end beneficiary of carbon removal. Assumed to be the Stripe account if not set.
    45  type ClimateOrderBeneficiaryParams struct {
    46  	// Publicly displayable name for the end beneficiary of carbon removal.
    47  	PublicName *string `form:"public_name"`
    48  }
    49  
    50  // Creates a Climate order object for a given Climate product. The order will be processed immediately
    51  // after creation and payment will be deducted your Stripe balance.
    52  type ClimateOrderParams struct {
    53  	Params `form:"*"`
    54  	// Requested amount of carbon removal units. Either this or `metric_tons` must be specified.
    55  	Amount *int64 `form:"amount"`
    56  	// Publicly sharable reference for the end beneficiary of carbon removal. Assumed to be the Stripe account if not set.
    57  	Beneficiary *ClimateOrderBeneficiaryParams `form:"beneficiary"`
    58  	// Request currency for the order as a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a supported [settlement currency for your account](https://stripe.com/docs/currencies). If omitted, the account's default currency will be used.
    59  	Currency *string `form:"currency"`
    60  	// Specifies which fields in the response should be expanded.
    61  	Expand []*string `form:"expand"`
    62  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
    63  	Metadata map[string]string `form:"metadata"`
    64  	// Requested number of tons for the order. Either this or `amount` must be specified.
    65  	MetricTons *float64 `form:"metric_tons,high_precision"`
    66  	// Unique identifier of the Climate product.
    67  	Product *string `form:"product"`
    68  }
    69  
    70  // AddExpand appends a new field to expand.
    71  func (p *ClimateOrderParams) AddExpand(f string) {
    72  	p.Expand = append(p.Expand, &f)
    73  }
    74  
    75  // AddMetadata adds a new key-value pair to the Metadata.
    76  func (p *ClimateOrderParams) AddMetadata(key string, value string) {
    77  	if p.Metadata == nil {
    78  		p.Metadata = make(map[string]string)
    79  	}
    80  
    81  	p.Metadata[key] = value
    82  }
    83  
    84  // Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
    85  // reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
    86  // might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
    87  // provides 90 days advance notice and refunds the amount_total.
    88  type ClimateOrderCancelParams struct {
    89  	Params `form:"*"`
    90  	// Specifies which fields in the response should be expanded.
    91  	Expand []*string `form:"expand"`
    92  }
    93  
    94  // AddExpand appends a new field to expand.
    95  func (p *ClimateOrderCancelParams) AddExpand(f string) {
    96  	p.Expand = append(p.Expand, &f)
    97  }
    98  
    99  type ClimateOrderBeneficiary struct {
   100  	// Publicly displayable name for the end beneficiary of carbon removal.
   101  	PublicName string `json:"public_name"`
   102  }
   103  
   104  // Specific location of this delivery.
   105  type ClimateOrderDeliveryDetailLocation struct {
   106  	// The city where the supplier is located.
   107  	City string `json:"city"`
   108  	// Two-letter ISO code representing the country where the supplier is located.
   109  	Country string `json:"country"`
   110  	// The geographic latitude where the supplier is located.
   111  	Latitude float64 `json:"latitude"`
   112  	// The geographic longitude where the supplier is located.
   113  	Longitude float64 `json:"longitude"`
   114  	// The state/county/province/region where the supplier is located.
   115  	Region string `json:"region"`
   116  }
   117  
   118  // Details about the delivery of carbon removal for this order.
   119  type ClimateOrderDeliveryDetail struct {
   120  	// Time at which the delivery occurred. Measured in seconds since the Unix epoch.
   121  	DeliveredAt int64 `json:"delivered_at"`
   122  	// Specific location of this delivery.
   123  	Location *ClimateOrderDeliveryDetailLocation `json:"location"`
   124  	// Quantity of carbon removal supplied by this delivery.
   125  	MetricTons string `json:"metric_tons"`
   126  	// Once retired, a URL to the registry entry for the tons from this delivery.
   127  	RegistryURL string `json:"registry_url"`
   128  	// A supplier of carbon removal.
   129  	Supplier *ClimateSupplier `json:"supplier"`
   130  }
   131  
   132  // Orders represent your intent to purchase a particular Climate product. When you create an order, the
   133  // payment is deducted from your merchant balance.
   134  type ClimateOrder struct {
   135  	APIResource
   136  	// Total amount of [Frontier](https://frontierclimate.com/)'s service fees in the currency's smallest unit.
   137  	AmountFees int64 `json:"amount_fees"`
   138  	// Total amount of the carbon removal in the currency's smallest unit.
   139  	AmountSubtotal int64 `json:"amount_subtotal"`
   140  	// Total amount of the order including fees in the currency's smallest unit.
   141  	AmountTotal int64                    `json:"amount_total"`
   142  	Beneficiary *ClimateOrderBeneficiary `json:"beneficiary"`
   143  	// Time at which the order was canceled. Measured in seconds since the Unix epoch.
   144  	CanceledAt int64 `json:"canceled_at"`
   145  	// Reason for the cancellation of this order.
   146  	CancellationReason ClimateOrderCancellationReason `json:"cancellation_reason"`
   147  	// For delivered orders, a URL to a delivery certificate for the order.
   148  	Certificate string `json:"certificate"`
   149  	// Time at which the order was confirmed. Measured in seconds since the Unix epoch.
   150  	ConfirmedAt int64 `json:"confirmed_at"`
   151  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   152  	Created int64 `json:"created"`
   153  	// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
   154  	Currency Currency `json:"currency"`
   155  	// Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
   156  	DelayedAt int64 `json:"delayed_at"`
   157  	// Time at which the order was delivered. Measured in seconds since the Unix epoch.
   158  	DeliveredAt int64 `json:"delivered_at"`
   159  	// Details about the delivery of carbon removal for this order.
   160  	DeliveryDetails []*ClimateOrderDeliveryDetail `json:"delivery_details"`
   161  	// The year this order is expected to be delivered.
   162  	ExpectedDeliveryYear int64 `json:"expected_delivery_year"`
   163  	// Unique identifier for the object.
   164  	ID string `json:"id"`
   165  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   166  	Livemode bool `json:"livemode"`
   167  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
   168  	Metadata map[string]string `json:"metadata"`
   169  	// Quantity of carbon removal that is included in this order.
   170  	MetricTons float64 `json:"metric_tons,string"`
   171  	// String representing the object's type. Objects of the same type share the same value.
   172  	Object string `json:"object"`
   173  	// Unique ID for the Climate `Product` this order is purchasing.
   174  	Product *ClimateProduct `json:"product"`
   175  	// Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
   176  	ProductSubstitutedAt int64 `json:"product_substituted_at"`
   177  	// The current status of this order.
   178  	Status ClimateOrderStatus `json:"status"`
   179  }
   180  
   181  // ClimateOrderList is a list of Orders as retrieved from a list endpoint.
   182  type ClimateOrderList struct {
   183  	APIResource
   184  	ListMeta
   185  	Data []*ClimateOrder `json:"data"`
   186  }