Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include sub_merchant #67

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pkg/payment/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Request struct {
MerchantServices *MerchantServicesRequest `json:"merchant_services,omitempty"`
Order *OrderRequest `json:"order,omitempty"`
Payer *PayerRequest `json:"payer,omitempty"`
ForwardData *ForwardDataRequest `json:"forward_data,omitempty"`
TransactionDetails *TransactionDetailsRequest `json:"transaction_details,omitempty"`
PointOfInteraction *PointOfInteractionRequest `json:"point_of_interaction,omitempty"`
PaymentMethod *PaymentMethodRequest `json:"payment_method,omitempty"`
Expand Down Expand Up @@ -177,6 +178,29 @@ type PayerRequest struct {
EntityType string `json:"entity_type,omitempty"`
}

// ForwardData represents data used in special conditions for the payment.
type ForwardDataRequest struct {
SubMerchant *SubMerchantRequest `json:"sub_merchant,omitempty"`
}

// SubMerchantRequest represents sub merchant request within ForwardDataRequest.
type SubMerchantRequest struct {
SubMerchantId string `json:"sub_merchant_id,omitempty"`
danielen-meli marked this conversation as resolved.
Show resolved Hide resolved
MCC string `json:"mcc,omitempty"`
Country string `json:"country,omitempty"`
AddressDoorNumber int `json:"address_door_number,omitempty"`
eltinMeli marked this conversation as resolved.
Show resolved Hide resolved
ZIP string `json:"zip,omitempty"`
DocumentNumber string `json:"document_number,omitempty"`
City string `json:"city,omitempty"`
AddressStreet string `json:"address_street,omitempty"`
LegalName string `json:"legal_name,omitempty"`
RegionCodeIso string `json:"region_code_iso,omitempty"`
danielen-meli marked this conversation as resolved.
Show resolved Hide resolved
RegionCode string `json:"region_code,omitempty"`
DocumentType string `json:"document_type,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
}

// AddressRequest represents payer address request within PayerRequest.
type AddressRequest struct {
Neighborhood string `json:"neighborhood,omitempty"`
Expand Down
22 changes: 22 additions & 0 deletions pkg/payment/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
// Response is the response from the Payments API.
type Response struct {
Payer PayerResponse `json:"payer"`
ForwardData ForwardDataResponse `json:"forward_data,omitempty"`
AdditionalInfo AdditionalInfoResponse `json:"additional_info"`
Order OrderResponse `json:"order"`
TransactionDetails TransactionDetailsResponse `json:"transaction_details"`
Expand Down Expand Up @@ -81,6 +82,27 @@ type PayerResponse struct {
EntityType string `json:"entity_type"`
}

type ForwardDataResponse struct {
SubMerchant SubMerchantResponse `json:"sub_merchant,omitempty"`
}

type SubMerchantResponse struct {
SubMerchantId string `json:"sub_merchant_id,omitempty"`
MCC string `json:"mcc,omitempty"`
Country string `json:"country,omitempty"`
AddressDoorNumber string `json:"address_door_number,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AddressDoorNumber string `json:"address_door_number,omitempty"`
AddressDoorNumber int `json:"address_door_number,omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O time confirmou que será INT

ZIP string `json:"zip,omitempty"`
DocumentNumber string `json:"document_number,omitempty"`
City string `json:"city,omitempty"`
AddressStreet string `json:"address_street,omitempty"`
LegalName string `json:"legal_name,omitempty"`
RegionCodeIso string `json:"region_code_iso,omitempty"`
RegionCode string `json:"region_code,omitempty"`
DocumentType string `json:"document_type,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
}

// IdentificationResponse represents payer's personal identification.
type IdentificationResponse struct {
Type string `json:"type"`
Expand Down
Loading