Skip to content

Commit

Permalink
Order struct fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gdeandradero committed Mar 13, 2024
1 parent 151f67d commit f007c5b
Show file tree
Hide file tree
Showing 31 changed files with 81 additions and 88 deletions.
6 changes: 3 additions & 3 deletions pkg/cardtoken/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type Response struct {
FirstSixDigits string `json:"first_six_digits"`
LastFourDigits string `json:"last_four_digits"`
Status string `json:"status"`
LuhnValidation bool `json:"luhn_validation"`
LiveMode bool `json:"live_mode"`
RequireEsc bool `json:"require_esc"`
ExpirationMonth int `json:"expiration_month"`
ExpirationYear int `json:"expiration_year"`
CardNumberLength int `json:"card_number_length"`
SecurityCodeLength int `json:"security_code_length"`
LuhnValidation bool `json:"luhn_validation"`
LiveMode bool `json:"live_mode"`
RequireEsc bool `json:"require_esc"`
}

type CardholderResponse struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/customer/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ type Request struct {
type AddressRequest struct {
City *CityRequest `json:"city,omitempty"`

StreetNumber int `json:"street_number,omitempty"`
ID string `json:"id,omitempty"`
ZipCode string `json:"zip_code,omitempty"`
StreetName string `json:"street_name,omitempty"`
StreetNumber int `json:"street_number,omitempty"`
}

// CityRequest represents a request for a city.
Expand Down
4 changes: 2 additions & 2 deletions pkg/customer/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ type IdentificationResponse struct {

// IssuerResponse represents a response for an issuer.
type IssuerResponse struct {
ID int `json:"id"`
Name string `json:"name"`
ID int `json:"id"`
}

// PaymentMethodResponse represents a response for a payment method.
Expand All @@ -89,8 +89,8 @@ type PaymentMethodResponse struct {

// SecurityCodeResponse represents a response for a security code.
type SecurityCodeResponse struct {
Length int `json:"length"`
CardLocation string `json:"card_location"`
Length int `json:"length"`
}

// CompleteAddressResponse represents a response for a complete address.
Expand Down
5 changes: 2 additions & 3 deletions pkg/customer/search_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
// Filters field can receive a lot of parameters. For details, see:
// https://www.mercadopago.com/developers/en/reference/customers/_customers_search/get.
type SearchRequest struct {
Limit int
Offset int
Filters map[string]string

Limit int
Offset int
}

// GetParams creates map to build query parameters. Keys will be changed to lower case.
Expand Down
2 changes: 1 addition & 1 deletion pkg/customer/search_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package customer

// SearchResponse represents the response from the search endpoint.
type SearchResponse struct {
Results []Response `json:"results"`
Paging PagingResponse `json:"paging"`
Results []Response `json:"results"`
}

// PagingResponse represents the paging information within SearchResponse.
Expand Down
4 changes: 2 additions & 2 deletions pkg/customercard/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ type IdentificationResponse struct {

// IssuerResponse represents the card issuer code.
type IssuerResponse struct {
ID int `json:"id"`
Name string `json:"name"`
ID int `json:"id"`
}

// PaymentMethodResponse represents the card's payment method.
Expand All @@ -60,6 +60,6 @@ type PaymentMethodResponse struct {

// SecurityCode represents the card's security code.
type SecurityCodeResponse struct {
Length int `json:"length"`
CardLocation string `json:"card_location"`
Length int `json:"length"`
}
2 changes: 1 addition & 1 deletion pkg/invoice/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ type Response struct {
Status string `json:"status"`
Summarized string `json:"summarized"`
Type string `json:"type"`
TransactionAmount float64 `json:"transaction_amount"`
ID int `json:"id"`
RetryAttempt int `json:"retry_attempt"`
TransactionAmount float64 `json:"transaction_amount"`
}

// PaymentResponse contains information about payment.
Expand Down
5 changes: 2 additions & 3 deletions pkg/invoice/search_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (

// SearchRequest is the helper structure to build search request.
type SearchRequest struct {
Limit int
Offset int
Filters map[string]string

Limit int
Offset int
}

// GetParams creates map to build query parameters. Keys will be changed to lower case.
Expand Down
2 changes: 1 addition & 1 deletion pkg/merchantorder/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ type ItemRequest struct {
PictureURL string `json:"picture_url,omitempty"`
CategoryID string `json:"category_id,omitempty"`
CurrencyID string `json:"currency_id,omitempty"`
Quantity int `json:"quantity,omitempty"`
UnitPrice float64 `json:"unit_price,omitempty"`
Quantity int `json:"quantity,omitempty"`
}

// CollectorRequest represents seller information.
Expand Down
12 changes: 6 additions & 6 deletions pkg/merchantorder/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ type Response struct {
Marketplace string `json:"marketplace"`
SponsorID string `json:"sponsor_id"`
OrderStatus string `json:"order_status"`
ID int64 `json:"id"`
Cancelled bool `json:"cancelled"`
PaidAmount float64 `json:"paid_amount"`
RefundedAmount float64 `json:"refunded_amount"`
ShippingCost float64 `json:"shipping_cost"`
TotalAmount float64 `json:"total_amount"`
ID int64 `json:"id"`
Cancelled bool `json:"cancelled"`
}

// PayerResponse represents buyer information.
Expand All @@ -54,11 +54,11 @@ type PaymentResponse struct {
StatusDetails string `json:"status_details"`
OperationType string `json:"operation_type"`
CurrencyID string `json:"currency_id"`
ID int64 `json:"id"`
TransactionAmount float64 `json:"transaction_amount"`
TotalPaidAmount float64 `json:"total_paid_amount"`
ShippingCost float64 `json:"shipping_cost"`
AmountRefunded float64 `json:"amount_refunded"`
ID int64 `json:"id"`
}

// ItemResponse represents item information.
Expand All @@ -69,8 +69,8 @@ type ItemResponse struct {
PictureURL string `json:"picture_url"`
CurrencyID string `json:"currency_id"`
CategoryID string `json:"category_id"`
Quantity int `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Quantity int `json:"quantity"`
}

// ShipmentResponse represents shipment information.
Expand Down Expand Up @@ -120,10 +120,10 @@ type ShippingOptionResponse struct {

Name string `json:"name"`
CurrencyID string `json:"currency_id"`
ID int64 `json:"id"`
ShippingMethodID int64 `json:"shipping_method_id"`
Cost float64 `json:"cost"`
ListCost float64 `json:"list_cost"`
ID int64 `json:"id"`
ShippingMethodID int64 `json:"shipping_method_id"`
}

// ReceiverAddressCityResponse represents city information.
Expand Down
5 changes: 2 additions & 3 deletions pkg/merchantorder/search_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
// Filters field can receive a lot of paramaters. For details, see:
// https://www.mercadopago.com/developers/en/reference/merchant_orders/_merchant_orders_search/get.
type SearchRequest struct {
Limit int
Offset int
Filters map[string]string

Limit int
Offset int
}

// GetParams creates map to build query parameters. Keys will be changed to lower case.
Expand Down
4 changes: 2 additions & 2 deletions pkg/merchantorder/update_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ type ShippingOptionRequest struct {

Name string `json:"name,omitempty"`
CurrencyID string `json:"currency_id,omitempty"`
ShippingMethodID int64 `json:"shipping_method_id,omitempty"`
ID int64 `json:"id,omitempty"`
Cost float64 `json:"cost,omitempty"`
ListCost float64 `json:"list_cost,omitempty"`
ShippingMethodID int64 `json:"shipping_method_id,omitempty"`
ID int64 `json:"id,omitempty"`
}

// ReceiverAddressCityRequest represents city information.
Expand Down
2 changes: 1 addition & 1 deletion pkg/oauth/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ type Response struct {
RefreshToken string `json:"refresh_token"`
PublicKey string `json:"public_key"`
TokenType string `json:"token_type"`
LiveMode bool `json:"live_mode"`
ExpiresIn int64 `json:"expires_in"`
LiveMode bool `json:"live_mode"`
}
10 changes: 5 additions & 5 deletions pkg/payment/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ type Request struct {
PaymentMethodOptionID string `json:"payment_method_option_id,omitempty"`
StatementDescriptor string `json:"statement_descriptor,omitempty"`
ThreeDSecureMode string `json:"three_d_secure_mode,omitempty"`
ApplicationFee float64 `json:"application_fee,omitempty"`
CouponAmount float64 `json:"coupon_amount,omitempty"`
NetAmount float64 `json:"net_amount,omitempty"`
TransactionAmount float64 `json:"transaction_amount,omitempty"`
Installments int `json:"installments,omitempty"`
CampaignID int64 `json:"campaign_id,omitempty"`
DifferentialPricingID int64 `json:"differential_pricing_id,omitempty"`
SponsorID int64 `json:"sponsor_id,omitempty"`
BinaryMode bool `json:"binary_mode,omitempty"`
Capture bool `json:"capture,omitempty"`
ApplicationFee float64 `json:"application_fee,omitempty"`
CouponAmount float64 `json:"coupon_amount,omitempty"`
NetAmount float64 `json:"net_amount,omitempty"`
TransactionAmount float64 `json:"transaction_amount,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}

Expand Down Expand Up @@ -116,8 +116,8 @@ type ItemRequest struct {
Description string `json:"description,omitempty"`
PictureURL string `json:"picture_url,omitempty"`
CategoryID string `json:"category_id,omitempty"`
Quantity int64 `json:"quantity,omitempty"`
UnitPrice float64 `json:"unit_price,omitempty"`
Quantity int64 `json:"quantity,omitempty"`
Warranty bool `json:"warranty,omitempty"`
}

Expand Down
16 changes: 8 additions & 8 deletions pkg/payment/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ type Response struct {
CallForAuthorizeID string `json:"call_for_authorize_id"`
StatementDescriptor string `json:"statement_descriptor"`
MoneyReleaseStatus string `json:"money_release_status"`
Installments int `json:"installments"`
ID int64 `json:"id"`
SponsorID int64 `json:"sponsor_id"`
CollectorID int64 `json:"collector_id"`
TransactionAmount float64 `json:"transaction_amount"`
TransactionAmountRefunded float64 `json:"transaction_amount_refunded"`
CouponAmount float64 `json:"coupon_amount"`
TaxesAmount float64 `json:"taxes_amount"`
ShippingAmount float64 `json:"shipping_amount"`
NetAmount float64 `json:"net_amount"`
Installments int `json:"installments"`
ID int64 `json:"id"`
SponsorID int64 `json:"sponsor_id"`
CollectorID int64 `json:"collector_id"`
LiveMode bool `json:"live_mode"`
Captured bool `json:"captured"`
BinaryMode bool `json:"binary_mode"`
Expand Down Expand Up @@ -103,8 +103,8 @@ type ItemResponse struct {
Description string `json:"description"`
PictureURL string `json:"picture_url"`
CategoryID string `json:"category_id"`
Quantity int `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
Quantity int `json:"quantity"`
}

// AdditionalInfoPayerResponse represents payer's additional information.
Expand Down Expand Up @@ -147,8 +147,8 @@ type ReceiverAddressResponse struct {

// OrderResponse represents order information.
type OrderResponse struct {
ID int `json:"id"`
Type string `json:"type"`
ID int `json:"id"`
}

// TransactionDetailsResponse represents transaction details.
Expand Down Expand Up @@ -325,10 +325,10 @@ type RefundResponse struct {
RefundMode string `json:"refund_mode"`
Reason string `json:"reason"`
UniqueSequenceNumber string `json:"unique_sequence_number"`
ID int64 `json:"id"`
PaymentID int64 `json:"payment_id"`
Amount float64 `json:"amount"`
AdjustmentAmount float64 `json:"adjustment_amount"`
ID int64 `json:"id"`
PaymentID int64 `json:"payment_id"`
}

// SourceResponse represents source information.
Expand Down
5 changes: 2 additions & 3 deletions pkg/payment/search_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
// Filters field can receive a lot of paramaters. For details, see:
// https://www.mercadopago.com/developers/en/reference/payments/_payments_search/get.
type SearchRequest struct {
Limit int
Offset int
Filters map[string]string

Limit int
Offset int
}

// GetParams creates map to build query parameters. Keys will be changed to lower case.
Expand Down
2 changes: 1 addition & 1 deletion pkg/payment/search_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package payment

// SearchResponse represents the response from the search endpoint.
type SearchResponse struct {
Results []Response `json:"results"`
Paging PagingResponse `json:"paging"`
Results []Response `json:"results"`
}

// PagingResponse represents the paging information within SearchResponse.
Expand Down
10 changes: 5 additions & 5 deletions pkg/paymentmethod/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ type Response struct {
SecureThumbnail string `json:"secure_thumbnail"`
Thumbnail string `json:"thumbnail"`
DeferredCapture string `json:"deferred_capture"`
AdditionalInfoNeeded []string `json:"additional_info_needed"`
ProcessingModes []string `json:"processing_modes"`
AccreditationTime int64 `json:"accreditation_time"`
MinAllowedAmount float64 `json:"min_allowed_amount"`
MaxAllowedAmount float64 `json:"max_allowed_amount"`
AccreditationTime int64 `json:"accreditation_time"`
AdditionalInfoNeeded []string `json:"additional_info_needed"`
ProcessingModes []string `json:"processing_modes"`
}

// SettingsResponse represents payment method settings.
Expand All @@ -34,15 +34,15 @@ type SettingsBinResponse struct {

// SettingsCardNumberResponse represents card number settings.
type SettingsCardNumberResponse struct {
Length int `json:"length"`
Validation string `json:"validation"`
Length int `json:"length"`
}

// SettingsSecurityCodeResponse represents security code settings.
type SettingsSecurityCodeResponse struct {
Mode string `json:"mode"`
Length int `json:"length"`
CardLocation string `json:"card_location"`
Length int `json:"length"`
}

// FinancialInstitutionResponse represents financial institution settings.
Expand Down
8 changes: 4 additions & 4 deletions pkg/point/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ type CreateRequest struct {
AdditionalInfo *AdditionalInfoRequest `json:"additional_info"`
Payment *PaymentRequest `json:"payment"`

Amount int `json:"amount"`
Description string `json:"description"`
Amount int `json:"amount"`
}

type AdditionalInfoRequest struct {
PrintOnTerminal bool `json:"print_on_terminal,omitempty"`
ExternalReference string `json:"external_reference,omitempty"`
TicketNumber string `json:"ticket_number,omitempty"`
PrintOnTerminal bool `json:"print_on_terminal,omitempty"`
}

type PaymentRequest struct {
ID int64 `json:"id,omitempty"`
Installments int `json:"installments,omitempty"`
Type string `json:"type,omitempty"`
InstallmentsCost string `json:"installments_cost,omitempty"`
ID int64 `json:"id,omitempty"`
Installments int `json:"installments,omitempty"`
}

type UpdateDeviceOperatingModeRequest struct {
Expand Down
Loading

0 comments on commit f007c5b

Please sign in to comment.