Documentation ¶
Index ¶
- Constants
- type CheckTransactionResponse
- type CreateCheckTransactionRequest
- type CreatePaymentRequest
- type CreateRefundRequest
- type CreateVerifyPaymentRequest
- type ErrorResponse
- type HTTPClient
- type PasargadPaymentAPI
- func (m *PasargadPaymentAPI) CheckTransaction(request CreateCheckTransactionRequest) (*CheckTransactionResponse, error)
- func (m *PasargadPaymentAPI) Redirect(request CreatePaymentRequest) (string, error)
- func (m *PasargadPaymentAPI) Refund(request CreateRefundRequest) (*RefundResponse, error)
- func (m *PasargadPaymentAPI) SetSign(sign string)
- func (m *PasargadPaymentAPI) VerifyPayment(request CreateVerifyPaymentRequest) (*VerifyPaymentResponse, error)
- type RedirectResponse
- type RefundResponse
- type Signer
- type VerifyPaymentResponse
- type XMLRSAKey
Constants ¶
const ( URL_GET_TOKEN = "https://pep.shaparak.ir/Api/v1/Payment/GetToken" // Redirect User with token to this URL. // e.q: https://pep.shaparak.ir/payment.aspx?n=Token URL_PAYMENT_GATEWAY = "https://pep.shaparak.ir/payment.aspx" URL_CHECK_TRANSACTION = "https://pep.shaparak.ir/Api/v1/Payment/CheckTransactionResult" URL_VERIFY_PAYMENT = "https://pep.shaparak.ir/Api/v1/Payment/VerifyPayment" URL_REFUND = "https://pep.shaparak.ir/Api/v1/Payment/RefundPayment" )
The API URLs
const ACTION_PAYMENT = "1003"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckTransactionResponse ¶
type CheckTransactionResponse struct { IsSuccess bool `json:"IsSuccess"` // status of request (True or False) Message string `json:"Message"` // Message - The response of server ReferenceNumber int64 `json:"ReferenceNumber"` // Reference number TraceNumber int64 `json:"TraceNumber"` // trace number TransactionDate string `json:"TransactionDate"` // transaction date Action string `json:"Action"` // action identifier TransactionReferenceID string `json:"TransactionReferenceID"` // transaaction internal reference id InvoiceNumber string `json:"InvoiceNumber"` // invoice number InvoiceDate string `json:"InvoiceDate"` // invoice date MerchantCode int64 `json:"MerchantCode"` // merchant code TerminalCode int64 `json:"TerminalCode"` // terminal code Amount int64 `json:"amount"` // transaction amount }
RedirectResponse data type
type CreateCheckTransactionRequest ¶
type CreateCheckTransactionRequest struct { TransactionReferenceID string `json:"transactionReferenceID"` // transaction reference id InvoiceNumber string `json:"invoiceNumber"` // invoice number InvoiceDate string `json:"invoiceDate"` // invoice date TerminalCode int64 `json:"terminalCode"` // terminal code MerchantCode int64 `json:"merchantCode"` // merchant code }
Check Transaction Data Types =================================================== CreateCheckTransactionRequest is the struct to create a checkTransaction request
func (*CreateCheckTransactionRequest) GetCheckTransactionRequest ¶
func (m *CreateCheckTransactionRequest) GetCheckTransactionRequest() CreateCheckTransactionRequest
GetCheckTransactionRequest and parameters
type CreatePaymentRequest ¶
type CreatePaymentRequest struct { Amount int64 `json:"amount"` // invoice amount InvoiceNumber string `json:"invoiceNumber"` // invoice number InvoiceDate string `json:"invoiceDate"` // invoice date Action string `json:"action"` // request action identifier Mobile string `json:"mobile"` // mobile number of the user Email string `json:"email"` // email address of the user MerchantCode int64 `json:"merchantCode"` // merchant code TerminalCode int64 `json:"terminalCode"` // terminal code RedirectAddress string `json:"redirectAddress"` // redirect url TimeStamp string `json:"timeStamp"` // Current timestamp (Y/m/d H:i:s) }
Redirect Data Types ========================================== CreatePaymentRequest is the format of our data to send to bank
func (*CreatePaymentRequest) GetRedirectRequest ¶
func (m *CreatePaymentRequest) GetRedirectRequest() CreatePaymentRequest
Get Redirect Request and it's parameters
type CreateRefundRequest ¶
type CreateRefundRequest struct { InvoiceNumber string `json:"invoiceNumber"` // invoice number InvoiceDate string `json:"invoiceDate"` // invoice date TerminalCode int64 `json:"terminalCode"` // terminal code MerchantCode int64 `json:"merchantCode"` // merchant code TimeStamp string `json:"timeStamp"` // Current timestamp (Y/m/d H:i:s) }
Refund Data Types ================================================== CreateRefundRequest is the struct to create a Refund Payment to user
func (*CreateRefundRequest) GetRefundRequest ¶
func (m *CreateRefundRequest) GetRefundRequest() CreateRefundRequest
GetRefundRequest and parameters
type CreateVerifyPaymentRequest ¶
type CreateVerifyPaymentRequest struct { Amount int64 `json:"amount"` // invoice amount InvoiceNumber string `json:"invoiceNumber"` // invoice number InvoiceDate string `json:"invoiceDate"` // invoice date TerminalCode int64 `json:"terminalCode"` // terminal code MerchantCode int64 `json:"merchantCode"` // merchant code TimeStamp string `json:"timeStamp"` // Current timestamp (Y/m/d H:i:s) }
Verify Payment Data Types ================================================ CreateVerifyPaymentRequest is the struct to create a VerifyPayment request
func (*CreateVerifyPaymentRequest) GetVerifyPaymentRequest ¶
func (m *CreateVerifyPaymentRequest) GetVerifyPaymentRequest() CreateVerifyPaymentRequest
GetVerifyPaymentRequest and parameters
type ErrorResponse ¶
type ErrorResponse struct { IsSuccess bool `json:"IsSuccess"` // status of request (True or False) Message string `json:"Message"` // Message - The response of server. }
General Types ================================================ ErrorResponse is the API error response.
func (ErrorResponse) Error ¶
func (m ErrorResponse) Error() string
Error returns a formatted error string.
type HTTPClient ¶
HTTPClient is HTTP client.
type PasargadPaymentAPI ¶
type PasargadPaymentAPI struct {
// contains filtered or unexported fields
}
PasargadPaymentAPI for rest
func PasargadAPI ¶
func PasargadAPI(merchantCode int64, terminalId int64, redirectUrl string, certificationFile string) *PasargadPaymentAPI
PasargadAPI creates a new PasargadPaymentAPI instance.
func PasargadAPIClient ¶
func PasargadAPIClient(merchantCode int64, terminalId int64, redirectUrl string, certificationFile string, httpClient HTTPClient) *PasargadPaymentAPI
PasargadAPIClient creates a new PasargadPaymentAPI instance and allows you to pass a http.Client.
func (*PasargadPaymentAPI) CheckTransaction ¶
func (m *PasargadPaymentAPI) CheckTransaction(request CreateCheckTransactionRequest) (*CheckTransactionResponse, error)
CheckTransaction method
func (*PasargadPaymentAPI) Redirect ¶
func (m *PasargadPaymentAPI) Redirect(request CreatePaymentRequest) (string, error)
Generate Payment URL
func (*PasargadPaymentAPI) Refund ¶
func (m *PasargadPaymentAPI) Refund(request CreateRefundRequest) (*RefundResponse, error)
Refund method
func (*PasargadPaymentAPI) SetSign ¶
func (m *PasargadPaymentAPI) SetSign(sign string)
SetSign sets new key.
func (*PasargadPaymentAPI) VerifyPayment ¶
func (m *PasargadPaymentAPI) VerifyPayment(request CreateVerifyPaymentRequest) (*VerifyPaymentResponse, error)
VerifyPayment method
type RedirectResponse ¶
type RedirectResponse struct { IsSuccess bool `json:"IsSuccess"` // status of request (True or False) Message string `json:"Message"` // Message - The response of server Token string `json:"Token"` // Token (for successful requests) }
RedirectResponse data type
type RefundResponse ¶
type RefundResponse struct { IsSuccess bool `json:"IsSuccess"` // status of request (True or False) Message string `json:"Message"` // Message - The response of server }
RefundResponse data type
type Signer ¶
type Signer struct {
Key *rsa.PrivateKey
}
type VerifyPaymentResponse ¶
type VerifyPaymentResponse struct { IsSuccess bool `json:"IsSuccess"` // status of request (True or False) Message string `json:"Message"` // Message - The response of server MaskedCardNumber string `json:"MaskedCardNumber"` // Masked Card Number (like: 5022-29**-****-2328) HashedCardNumber string `json:"HashedCardNumber"` // Hashed Card Number (like: 2DDB1E270C598.....) ShaparakRefNumber string `json:"ShaparakRefNumber"` // Shaparak Reference ID (like: 100200300400500) }
VerifyPaymentResponse VerifyPaymentResponse data type