Add shipping types documentation

bot-api-6.1
Ilya Kaznacheev 2020-10-24 23:27:45 +03:00
parent 6964c7af4e
commit 5844ea113e
No known key found for this signature in database
GPG Key ID: 7E2C1D8A4AB37D50
1 changed files with 42 additions and 12 deletions

View File

@ -1644,39 +1644,69 @@ type Invoice struct {
Currency string `json:"currency"` Currency string `json:"currency"`
// TotalAmount otal price in the smallest units of the currency (integer, not float/double). // TotalAmount otal price in the smallest units of the currency (integer, not float/double).
// For example, for a price of US$ 1.45 pass amount = 145. // For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json, it shows the number of digits // See the exp parameter in currencies.json
// past the decimal point for each currency (2 for the majority of currencies). // (https://core.telegram.org/bots/payments/currencies.json),
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"` TotalAmount int `json:"total_amount"`
} }
// LabeledPrice represents a portion of the price for goods or services. // LabeledPrice represents a portion of the price for goods or services.
type LabeledPrice struct { type LabeledPrice struct {
Label string `json:"label"` // Label portion label
Amount int `json:"amount"` Label string `json:"label"`
// Amount price of the product in the smallest units of the currency (integer, not float/double).
// For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json
// (https://core.telegram.org/bots/payments/currencies.json),
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies).
Amount int `json:"amount"`
} }
// ShippingAddress represents a shipping address. // ShippingAddress represents a shipping address.
type ShippingAddress struct { type ShippingAddress struct {
// CountryCode ISO 3166-1 alpha-2 country code
CountryCode string `json:"country_code"` CountryCode string `json:"country_code"`
State string `json:"state"` // State if applicable
City string `json:"city"` State string `json:"state"`
// City city
City string `json:"city"`
// StreetLine1 fFirst line for the address
StreetLine1 string `json:"street_line1"` StreetLine1 string `json:"street_line1"`
// StreetLine2 second line for the address
StreetLine2 string `json:"street_line2"` StreetLine2 string `json:"street_line2"`
PostCode string `json:"post_code"` // PostCode address post code
PostCode string `json:"post_code"`
} }
// OrderInfo represents information about an order. // OrderInfo represents information about an order.
type OrderInfo struct { type OrderInfo struct {
Name string `json:"name,omitempty"` // Name user name
PhoneNumber string `json:"phone_number,omitempty"` //
Email string `json:"email,omitempty"` // optional
Name string `json:"name,omitempty"`
// PhoneNumber user's phone number
//
// optional
PhoneNumber string `json:"phone_number,omitempty"`
// Email user email
//
// optional
Email string `json:"email,omitempty"`
// ShippingAddress user shipping address
//
// optional
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"` ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
} }
// ShippingOption represents one shipping option. // ShippingOption represents one shipping option.
type ShippingOption struct { type ShippingOption struct {
ID string `json:"id"` // ID shipping option identifier
Title string `json:"title"` ID string `json:"id"`
// Title option title
Title string `json:"title"`
// Prices list of price portions
Prices *[]LabeledPrice `json:"prices"` Prices *[]LabeledPrice `json:"prices"`
} }