Documentation
¶
Index ¶
- Constants
- type CallBackGetFunc
- type CallBackPostFunc
- type ErrorResponse
- type IdPay
- func (i *IdPay) CreateTransaction(ctx context.Context, req *PaymentRequest) (*PaymentResponse, error)
- func (i *IdPay) TransactionList(ctx context.Context, req *TransactionListRequest) (*TransactionListResponse, error)
- func (i *IdPay) TransactionStatus(ctx context.Context, req *TransactionStatusRequest) (*TransactionStatusResponse, error)
- func (i *IdPay) VerifyTransaction(ctx context.Context, req *VerifyRequest) (*VerifyResponse, error)
- type PaymentRequest
- type PaymentResponse
- type TransactionListRequest
- type TransactionListResponse
- type TransactionStatusRequest
- type TransactionStatusResponse
- type VerifyRequest
- type VerifyResponse
Constants ¶
View Source
const ( IDPAY_HOST = "https://api.idpay.ir" PAYMENT_ENDPOINT = "/v1.1/payment" VERIFY_ENDPOINT = "/v1.1/payment/verify" INQUIRY_ENDPOINT = "/v1.1/payment/inquiry" TRANSACTIONS_ENDPOINT = "/v1.1/payment/transactions" )
View Source
const API_VERSION = "1.1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallBackGetFunc ¶ added in v1.1.3
type CallBackPostFunc ¶ added in v1.1.3
type ErrorResponse ¶
type IdPay ¶
type IdPay struct {
// contains filtered or unexported fields
}
func (*IdPay) CreateTransaction ¶
func (i *IdPay) CreateTransaction(ctx context.Context, req *PaymentRequest) (*PaymentResponse, error)
CreateTransaction create a new transaction and return id and link
func (*IdPay) TransactionList ¶
func (i *IdPay) TransactionList(ctx context.Context, req *TransactionListRequest) (*TransactionListResponse, error)
TransactionList get list of transaction with set page size and page
func (*IdPay) TransactionStatus ¶
func (i *IdPay) TransactionStatus(ctx context.Context, req *TransactionStatusRequest) (*TransactionStatusResponse, error)
TransactionStatus check transaction status and return transaction details
func (*IdPay) VerifyTransaction ¶
func (i *IdPay) VerifyTransaction(ctx context.Context, req *VerifyRequest) (*VerifyResponse, error)
VerifyTransaction verify an transaction base on id and order id
type PaymentRequest ¶
type PaymentRequest struct {
OrderId string `validate:"required,max=50" json:"order_id"`
Amount uint `validate:"required,min=1000,max=5000000000" json:"amount"`
Name string `validate:"omitempty,max=255" json:"name"`
Phone string `validate:"omitempty,max=11" json:"phone"`
Mail string `validate:"email,max=255" json:"mail"`
Desc string `validate:"omitempty,max=255" json:"desc"`
Callback string `validate:"required,max=2048,url" json:"callback"`
}
type PaymentResponse ¶
type TransactionListRequest ¶
type TransactionListRequest struct {
Page int `json:"-"`
PageSize int `json:"-"`
Id string `json:"id"`
OrderId string `validate:"omitempty,max=50" json:"order_id"`
Amount uint `validate:"omitempty,max=5000000000,min=1000" json:"amount"`
Status []string `json:"status"`
TrackId string `json:"track_id"`
PaymentCardNo string `validate:"omitempty,max=16" json:"payment_card_no"`
PaymentHashedCardNo string `json:"payment_hashed_card_no"`
PaymentDate struct {
Min uint `json:"min"`
Max uint `json:"max"`
} `json:"payment_date"`
SettlementDate struct {
Min uint `json:"min"`
Max uint `json:"max"`
} `json:"settlement_date"`
}
type TransactionListResponse ¶
type TransactionListResponse struct {
Attachment struct {
Timestamp int `json:"timestamp"`
TotalCount int `json:"total_count"`
PageCount int `json:"page_count"`
CurrentPage int `json:"current_page"`
TotalAmount string `json:"total_amount"`
PageAmount int `json:"page_amount"`
} `json:"attachment"`
Records []*struct {
Id string `json:"id"`
Status string `json:"status"`
TrackId string `json:"track_id"`
OrderId string `json:"order_id"`
Amount string `json:"amount"`
Wage struct {
By string `json:"by"`
Type string `json:"type"`
Amount string `json:"amount"`
} `json:"wage"`
Date int `json:"date"`
Payer struct {
Name string `json:"name"`
Phone string `json:"phone"`
Mail string `json:"mail"`
Desc string `json:"desc"`
} `json:"payer"`
Payment struct {
TrackId string `json:"track_id"`
Amount string `json:"amount"`
CardNo string `json:"card_no"`
HashedCardNo string `json:"hashed_card_no"`
Date string `json:"date"`
} `json:"payment"`
Verify struct {
Date string `json:"date"`
} `json:"verify"`
Settlement struct {
Account struct {
Id string `json:"id"`
Iban string `json:"iban"`
Number string `json:"number"`
Bank struct {
Id string `json:"id"`
Title string `json:"title"`
} `json:"bank"`
} `json:"account"`
TrackId string `json:"track_id"`
Amount string `json:"amount"`
Date string `json:"date"`
} `json:"settlement"`
} `json:"records"`
}
type TransactionStatusResponse ¶
type TransactionStatusResponse struct {
Id string `json:"id"`
Status string `json:"status"`
TrackId string `json:"track_id"`
OrderId string `json:"order_id"`
Amount string `json:"amount"`
Wage struct {
By string `json:"by"`
Type string `json:"type"`
Amount string `json:"amount"`
} `json:"wage"`
Date int `json:"date"`
Payer struct {
Name string `json:"name"`
Phone string `json:"phone"`
Mail string `json:"mail"`
Desc string `json:"desc"`
} `json:"payer"`
Payment struct {
TrackId string `json:"track_id"`
Amount string `json:"amount"`
CardNo string `json:"card_no"`
HashedCardNo string `json:"hashed_card_no"`
Date string `json:"date"`
} `json:"payment"`
Verify struct {
Date string `json:"date"`
} `json:"verify"`
Settlement struct {
TrackId string `json:"track_id"`
Amount string `json:"amount"`
Date string `json:"date"`
} `json:"settlement"`
}
type VerifyRequest ¶
type VerifyResponse ¶
type VerifyResponse struct {
Id string `json:"id"`
Status string `json:"status"`
TrackId string `json:"track_id"`
OrderId string `json:"order_id"`
Amount string `json:"amount"`
Date string `json:"date"`
Payment struct {
TrackId string `json:"track_id"`
Amount string `json:"amount"`
CardNo string `json:"card_no"`
HashedCardNo string `json:"hashed_card_no"`
Date string `json:"date"`
} `json:"payment"`
Verify struct {
Date int `json:"date"`
} `json:"verify"`
}
Click to show internal directories.
Click to hide internal directories.