Skip to content

Commit

Permalink
Include sub merchant (#69)
Browse files Browse the repository at this point in the history
* include sub_merchant

* update address_door_number type
  • Loading branch information
danielen-meli authored Jul 4, 2024
1 parent c4833ca commit 5454af2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
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"`
MCC string `json:"mcc,omitempty"`
Country string `json:"country,omitempty"`
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"`
AddressDoorNumber int `json:"address_door_number,omitempty"`
}

// AddressRequest represents payer address request within PayerRequest.
type AddressRequest struct {
Neighborhood string `json:"neighborhood,omitempty"`
Expand Down
23 changes: 23 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,28 @@ type PayerResponse struct {
EntityType string `json:"entity_type"`
}

// ForwardData represents data used in special conditions for the payment.
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"`
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"`
AddressDoorNumber int `json:"address_door_number,omitempty"`
}

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

0 comments on commit 5454af2

Please sign in to comment.