zarinpal

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZARINPAL_HOST         = "https://api.zarinpal.com"
	ZARINPAL_SANDBOX_HOST = "https://sandbox.zarinpal.com"
)
View Source
const (
	ZARINPAL_REQUEST_API_ENDPOINT                = "/pg/v4/payment/request.json"
	ZARINPAL_VERIFY_API_ENDPOINT                 = "/pg/v4/payment/verify.json"
	ZARINPAL_UNVERIFIED_TRANSACTION_API_ENDPOINT = "/pg/v4/payment/unVerified.json"
)
View Source
const API_VERSION = "4"

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Code        int      `json:"code"`
	Message     string   `json:"message"`
	Authority   string   `json:"authority,omitempty"`
	CardHash    string   `json:"card_hash,omitempty"`
	CardPan     string   `json:"card_pan,omitempty"`
	RefID       int      `json:"ref_id,omitempty"`
	FeeType     string   `json:"fee_type,omitempty"`
	Fee         int      `json:"fee,omitempty"`
	Wages       []*Wages `json:"wages,omitempty"`
	Authorities []struct {
		Authority   string `json:"authority"`
		Amount      int    `json:"amount"`
		CallBackURL string `json:"callback_url"`
		Referer     string `json:"referer"`
		Date        string `json:"date"`
	} `json:"authorities,omitempty"`
}

type FloatingShareSettlementResponse

type FloatingShareSettlementResponse struct {
	Wages []*Wages `json:"wages"`
}

type PaymentResponse

type PaymentResponse struct {
	Data   *Data    `json:"data"`
	Errors []string `json:"errors"`
}

type UnverifiedTransactionsResponse

type UnverifiedTransactionsResponse struct {
	Data *Data `json:"data"`
}

type VerifyFloatingShareSettlementResponse

type VerifyFloatingShareSettlementResponse struct {
	Data   *Data    `json:"data"`
	Errors []string `json:"errors"`
}

type VerifyResponse

type VerifyResponse struct {
	Data   *Data    `json:"data"`
	Errors []string `json:"errors"`
}

type Wages

type Wages struct {
	Iban        string `json:"iban"`
	Amount      int    `json:"amount"`
	Description string `json:"description"`
}

type Zarinpal

type Zarinpal struct {
	// contains filtered or unexported fields
}

func New

func New(client client.Transporter, merchantID string, sandbox bool) (*Zarinpal, error)

New create zarinpal provider object for user factory request methods

func (*Zarinpal) FloatingShareSettlement

func (z *Zarinpal) FloatingShareSettlement(ctx context.Context, amount uint, description, callbackUrl string, wages []*Wages, metaData map[string]interface{}) (*FloatingShareSettlementResponse, error)

FloatingShareSettlement a special method is used for sellers who benefit from an incoming amount, more information in https://docs.zarinpal.com/paymentGateway/setshare.html#%D8%AA%D8%B3%D9%88%DB%8C%D9%87-%D8%A7%D8%B4%D8%AA%D8%B1%D8%A7%DA%A9%DB%8C-%D8%B4%D9%86%D8%A7%D9%88%D8%B1

func (*Zarinpal) RequestPayment

func (z *Zarinpal) RequestPayment(ctx context.Context, amount uint, callBackUrl, currency, description string, metaData map[string]interface{}) (*PaymentResponse, error)

RequestPayment create payment request and return status code and authority

func (*Zarinpal) UnverifiedTransactions

func (z *Zarinpal) UnverifiedTransactions(ctx context.Context) (*UnverifiedTransactionsResponse, error)

UnverifiedTransactions get unverified transactions from provider

func (*Zarinpal) VerifyFloatingShareSettlement

func (z *Zarinpal) VerifyFloatingShareSettlement(ctx context.Context, amount uint, authority string) (*VerifyFloatingShareSettlementResponse, error)

VerifyFloatingShareSettlement verify floating share settlement

func (*Zarinpal) VerifyPayment

func (z *Zarinpal) VerifyPayment(ctx context.Context, amount uint, authority string) (*VerifyResponse, error)

VerifyPayment transaction by merchant id, amount and authority to payment provider

Jump to

Keyboard shortcuts

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