fondy

package module
Version: v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 13 Imported by: 0

README

Fondy package for Go language

This package provides Go implementation of Fondy api.

Installation

Use the go command:

$ go get github.com/srostyslav/fondy-go

Requirements

Fondy package tested against Go 1.13.

Support only 2.0 protocol & json format

Example

package main

import (
    "github.com/srostyslav/fondy"
    "github.com/satori/go.uuid"
    "fmt"
)

func main() {
    api := fondy.NewApi(&fondy.ApiOptions{MerchantID: 1396424, SecretKey: "test"})
    
    data := &fondy.Checkout{
		Amount: 100,
		Currency: "USD",
                OrderDesc: "Pay for order",
		OrderID: uuid.NewV4().String(),
	}
	if url, err := api.CheckoutUrl(data); err != nil {
		panic(err)
	} else {
		fmt.Println("go to pay: " + url)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Options *ApiOptions
	ApiUrl  string
}

func NewApi

func NewApi(options *ApiOptions) *Api

func (*Api) AtolLogs

func (a *Api) AtolLogs(orderID string) (interface{}, error)

func (*Api) Capture

func (a *Api) Capture(data *Capture) (string, error)

func (*Api) CheckSignature

func (a *Api) CheckSignature(response map[string]interface{}) error

func (*Api) CheckoutSubscription

func (a *Api) CheckoutSubscription(data *Checkout) (string, error)

func (*Api) CheckoutToken

func (a *Api) CheckoutToken(data *Checkout) (string, error)

func (*Api) CheckoutUrl

func (a *Api) CheckoutUrl(data *Checkout) (string, error)

func (*Api) CheckoutVerification

func (a *Api) CheckoutVerification(data *Checkout) (string, error)

func (*Api) GetOrderStatus

func (a *Api) GetOrderStatus(orderID string) (map[string]interface{}, error)

func (*Api) GetReports

func (a *Api) GetReports(dateFrom, dateTo time.Time) ([]map[string]interface{}, error)

func (*Api) GetResponse

func (a *Api) GetResponse(content []byte, obj interface{}, checkSignature bool) error

func (*Api) GetSignature

func (a *Api) GetSignature(data string) string

func (*Api) P2Pcredit

func (a *Api) P2Pcredit(data *P2Pcredit) (map[string]interface{}, error)

func (*Api) PcidssStep1

func (a *Api) PcidssStep1(data *PCIDSSOneStep) (map[string]interface{}, error)

func (*Api) PcidssStep2

func (a *Api) PcidssStep2(data *PCIDSSTwoStep) (map[string]interface{}, error)

func (*Api) Recurring

func (a *Api) Recurring(data *RecurringBody) (map[string]interface{}, error)

func (*Api) Reverse

func (a *Api) Reverse(data *Reverse) (string, error)

func (*Api) Settlement

func (a *Api) Settlement(data *Settlement) (int64, error)

func (*Api) ToB64

func (a *Api) ToB64(data interface{}) (string, error)

func (*Api) TransactionList

func (a *Api) TransactionList(orderID string) ([]map[string]interface{}, error)

type ApiOptions

type ApiOptions struct {
	MerchantID  int64  // Merchant id numeric
	SecretKey   string // Secret key string
	RequestType string // request type allowed json, xml, form
	ApiDomain   string // api domain
	ApiProtocol string // allowed protocols 1.0, 2.0
}

type Capture

type Capture struct {
	OrderID  string `json:"order_id"`
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
}

type Checkout

type Checkout struct {
	OrderID                 string     `json:"order_id"`
	OrderDesc               string     `json:"order_desc"`
	Amount                  int64      `json:"amount"`
	Currency                string     `json:"currency"`
	ResponseUrl             string     `json:"response_url,omitempty"`
	ServerCallbackUrl       string     `json:"server_callback_url,omitempty"`
	PaymentSystems          string     `json:"payment_systems,omitempty"`
	DefaultPaymentSystem    string     `json:"default_payment_system,omitempty"`
	Lifetime                int64      `json:"lifetime,omitempty"`
	MerchantData            string     `json:"merchant_data,omitempty"`
	Preauth                 string     `json:"preauth,omitempty"`
	SenderEmail             string     `json:"sender_email,omitempty"`
	Descriptor              string     `json:"descriptor,omitempty"`
	Delayed                 string     `json:"delayed,omitempty"`
	Lang                    string     `json:"lang,omitempty"`
	ProductID               string     `json:"product_id,omitempty"`
	RequiredRectoken        string     `json:"required_rectoken,omitempty"`
	Verification            string     `json:"verification,omitempty"`
	VerificationType        string     `json:"verification_type,omitempty"`
	Rectoken                string     `json:"rectoken,omitempty"`
	ReceiverRectoken        string     `json:"receiver_rectoken,omitempty"`
	DesignID                int64      `json:"design_id,omitempty"`
	Subscription            string     `json:"subscription,omitempty"`
	SubscriptionCallbackUrl string     `json:"subscription_callback_url,omitempty"`
	RecurringData           *Recurring `json:"recurring_data,omitempty"`
}

type P2Pcredit

type P2Pcredit struct {
	ReceiverCardNumber string `json:"receiver_card_number,omitempty"`
	ReceiverRectoken   string `json:"receiver_rectoken,omitempty"`
	OrderID            string `json:"order_id"`
	OrderDesc          string `json:"order_desc"`
	Currency           string `json:"currency"`
	Amount             string `json:"amount"`
}

type PCIDSSOneStep

type PCIDSSOneStep struct {
	OrderID          string `json:"order_id,omitempty"`
	OrderDesc        string `json:"order_desc,omitempty"`
	Amount           string `json:"amount,omitempty"`
	Currency         string `json:"currency,omitempty"`
	CardNumber       string `json:"card_number,omitempty"`
	Cvv2             string `json:"cvv2,omitempty"`
	ExpiryDate       string `json:"expiry_date,omitempty"`
	ClientIP         string `json:"client_ip,omitempty"`
	Container        string `json:"container,omitempty"`
	RequiredRectoken string `json:"required_rectoken"`
	Preauth          string `json:"preauth"`
}

type PCIDSSTwoStep

type PCIDSSTwoStep struct {
	OrderID string `json:"order_id,omitempty"`
	Pareq   string `json:"pareq"`
	Md      string `json:"md"`
}

type Receiver

type Receiver struct {
	Type       string      `json:"type"`
	Requisites *Requisites `json:"requisites"`
}

type Recurring

type Recurring struct {
	StartTime string `json:"start_time,omitempty"` // start date of the recurring order ('YYYY-MM-DD')
	Amount    int64  `json:"amount,omitempty"`     // amount of the recurring order (int)
	Period    string `json:"period,omitempty"`     // period of the recurring order ('day', 'month', 'year')
	Every     int64  `json:"every,omitempty"`      // frequency of the recurring order (int)
	Readonly  string `json:"readonly,omitempty"`   // possibility to change parameters of the recurring order by user ('y', 'n')
	State     string `json:"state,omitempty"`      // default state of the recurring order after opening url of the order ('y', 'n')
}

type RecurringBody

type RecurringBody struct {
	OrderID   string `json:"order_id"`
	OrderDesc string `json:"order_desc"`
	Currency  string `json:"currency"`
	Amount    string `json:"amount"`
	Rectoken  string `json:"rectoken"`
}

type Requisites

type Requisites struct {
	Amount                float64 `json:"amount"`
	SettlementDescription string  `json:"settlement_description,omitempty"`
	MerchantID            int64   `json:"merchant_id,omitempty"`
	Okpo                  int64   `json:"okpo,omitempty"`
	JurName               string  `json:"jur_name,omitempty"`
	Account               int64   `json:"account,omitempty"`
	Rectoken              string  `json:"rectoken,omitempty"`
	CardNumber            int64   `json:"card_number,omitempty"`
}

type Response

type Response struct {
	ResponseStatus string `json:"response_status"`
	ErrorCode      int    `json:"error_code"`
	ErrorMessage   string `json:"error_message"`
}

func (*Response) GetError

func (r *Response) GetError() error

type Reverse

type Reverse struct {
	OrderID  string `json:"order_id"`
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
	Comment  string `json:"comment"`
}

type Settlement

type Settlement struct {
	ServerCallbackUrl string     `json:"server_callback_url,omitempty"`
	Rectoken          string     `json:"rectoken,omitempty"`
	Currency          string     `json:"currency"`
	Amount            string     `json:"amount"`
	OrderType         string     `json:"order_type"`
	ResponseUrl       string     `json:"response_url,omitempty"`
	OrderID           string     `json:"order_id"`
	OperationID       string     `json:"operation_id"`
	OrderDesc         string     `json:"order_desc,omitempty"`
	Receiver          []Receiver `json:"receiver"`
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL