Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoRecurringRequest ¶
type AutoRecurringRequest struct { FreeTrial *FreeTrialRequest `json:"free_trial,omitempty"` StartDate *time.Time `json:"start_date,omitempty"` EndDate *time.Time `json:"end_date,omitempty"` CurrencyID string `json:"currency_id,omitempty"` FrequencyType string `json:"frequency_type,omitempty"` TransactionAmount float64 `json:"transaction_amount,omitempty"` Frequency int `json:"frequency,omitempty"` }
AutoRecurringRequest represents the recurrence settings.
type AutoRecurringResponse ¶
type AutoRecurringResponse struct { FreeTrial FreeTrialResponse `json:"free_trial"` StartDate time.Time `json:"start_date"` EndDate time.Time `json:"end_date"` CurrencyID string `json:"currency_id"` FrequencyType string `json:"frequency_type"` TransactionAmount float64 `json:"transaction_amount"` Frequency int `json:"frequency"` }
AutoRecurringResponse represents the recurrence settings.
type AutoRecurringUpdateRequest ¶
type AutoRecurringUpdateRequest struct { StartDate *time.Time `json:"start_date,omitempty"` EndDate *time.Time `json:"end_date,omitempty"` TransactionAmount float64 `json:"transaction_amount,omitempty"` }
AutoRecurringUpdateRequest represents the recurrence settings.
type Client ¶
type Client interface { // Create creates a new pre-approval. // It is a post request to the endpoint: https://api.mercadopago.com/preapproval // Reference: https://www.mercadopago.com/developers/en/reference/subscriptions/_preapproval/post Create(ctx context.Context, request Request) (*Response, error) // Get finds a pre-approval by ID. // It is a get request to the endpoint: https://api.mercadopago.com/preapproval/{id} // Reference: https://www.mercadopago.com/developers/en/reference/subscriptions/_preapproval_id/get Get(ctx context.Context, id string) (*Response, error) // Update updates details a pre-approval by ID. // It is a put request to the endpoint: https://api.mercadopago.com/preapproval/{id} // Reference: https://www.mercadopago.com/developers/en/reference/subscriptions/_preapproval_id/put Update(ctx context.Context, id string, request UpdateRequest) (*Response, error) // Search finds all pre-approval information generated through specific filters. // It is a get request to the endpoint: https://api.mercadopago.com/preapproval/search // Reference: https://www.mercadopago.com/developers/en/reference/subscriptions/_preapproval_search/get Search(ctx context.Context, request SearchRequest) (*SearchResponse, error) }
Client contains the methods to interact with the Pre Approval API.
type FreeTrialRequest ¶
type FreeTrialRequest struct { FrequencyType string `json:"frequency_type,omitempty"` Frequency int `json:"frequency,omitempty"` FirstInvoiceOffset int `json:"first_invoice_offset,omitempty"` }
FreeTrialRequest represents the free trial settings.
type FreeTrialResponse ¶
type FreeTrialResponse struct { FrequencyType string `json:"frequency_type"` Frequency int `json:"frequency"` FirstInvoiceOffset int `json:"first_invoice_offset"` }
FreeTrialResponse represents the free trial settings.
type PagingResponse ¶
type PagingResponse struct { Total int `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` }
PagingResponse represents the paging information within SearchResponse.
type Request ¶
type Request struct { AutoRecurring *AutoRecurringRequest `json:"auto_recurring,omitempty"` CardTokenID string `json:"card_token_id,omitempty"` PreapprovalPlanID string `json:"preapproval_plan_id,omitempty"` PayerEmail string `json:"payer_email,omitempty"` BackURL string `json:"back_url,omitempty"` CollectorID string `json:"collector_id,omitempty"` Reason string `json:"reason,omitempty"` ExternalReference string `json:"external_reference,omitempty"` Status string `json:"status,omitempty"` }
Request represents a request for creating a pre approval.
type Response ¶
type Response struct { AutoRecurring AutoRecurringResponse `json:"auto_recurring"` Summarized SummarizedResponse `json:"summarized"` DateCreated time.Time `json:"date_created"` LastModified time.Time `json:"last_modified"` NextPaymentDate time.Time `json:"next_payment_date"` ID string `json:"id"` PayerEmail string `json:"payer_email"` Status string `json:"status"` Reason string `json:"reason"` ExternalReference string `json:"external_reference"` InitPoint string `json:"init_point"` SandboxInitPoint string `json:"sandbox_init_point"` PaymentMethodID string `json:"payment_method_id"` FirstInvoiceOffset int `json:"first_invoice_offset"` BackURL string `json:"back_url"` PreapprovalPlanID string `json:"preapproval_plan_id"` PayerFirstName string `json:"payer_first_name"` PayerLastName string `json:"payer_last_name"` CardID string `json:"card_id"` Version int `json:"version"` PayerID int64 `json:"payer_id"` CollectorID int64 `json:"collector_id"` ApplicationID int `json:"application_id"` }
Response represents the response from the pre-approval endpoint.
type SearchRequest ¶
SearchRequest contains filters accepted in search. Filters field can receive a lot of parameters. For details, see: https://www.mercadopago.com/developers/en/reference/subscriptions/_preapproval_search/get
func (SearchRequest) GetParams ¶
func (sr SearchRequest) GetParams() map[string]string
GetParams creates map to build query parameters. Keys will be changed to lower case.
type SearchResponse ¶
type SearchResponse struct { Paging PagingResponse `json:"paging"` Results []Response `json:"results"` }
SearchResponse represents the response from the search endpoint.
type SummarizedResponse ¶
type SummarizedResponse struct { LastChargedDate time.Time `json:"last_charged_date"` LastChargedAmount float64 `json:"last_charged_amount"` Semaphore string `json:"semaphore"` PendingChargeAmount float64 `json:"pending_charge_amount"` ChargedAmount float64 `json:"charged_amount"` Quotas int `json:"quotas"` PendingChargeQuantity int `json:"pending_charge_quantity"` ChargedQuantity int `json:"charged_quantity"` }
SummarizedResponse contains summary information about invoices and subscription charges.
type UpdateRequest ¶
type UpdateRequest struct { AutoRecurring *AutoRecurringUpdateRequest `json:"auto_recurring,omitempty"` CardTokenID string `json:"card_token_id,omitempty"` PayerEmail string `json:"payer_email,omitempty"` BackURL string `json:"back_url,omitempty"` Reason string `json:"reason,omitempty"` ExternalReference string `json:"external_reference,omitempty"` Status string `json:"status,omitempty"` }
UpdateRequest represents a request for updating a pre approval.