Documentation ¶
Index ¶
- Constants
- type AccountsResource
- type Client
- type Config
- type CreateTransferRequest
- type CreateTransferRequestParams
- type CreateTransferResponse
- type CreateTransferResponseParams
- type CurrencyCode
- type GetAccountsRequest
- type GetAccountsResponse
- type GetAccountsResponseParams
- type GetBalancesRequest
- type GetBalancesResponse
- type GetBalancesResponseParams
- type GetDetailsDetailParamsInterface
- type GetDetailsRequest
- type GetDetailsRequestDetailParamsString
- type GetDetailsRequestDetailParamsStruct
- type GetDetailsResponse
- type GetDetailsResponseDetailParams
- type GetHistoryRequest
- type GetHistoryRequestParams
- type GetHistoryResponse
- type GetHistoryResponseDetailParams
- type GetHistoryResponseHistoryParams
- type GetHistoryResponsePageParams
- type RequestAuthParams
- type RequestBuilder
- type RequestParams
- type RequestParamsAttributes
- type ResourceAbstract
- type ResponseBody
- type ResponseBodyErrorParams
- type ResponseBodyErrors
- type TransactionFeeMode
- type TransactionStatus
- type TransactionType
- type TransfersResource
- func (r *TransfersResource) CreateTransfer(transfers []*CreateTransferRequestParams, ctx context.Context, ...) (*CreateTransferResponse, *http.Response, error)
- func (r *TransfersResource) GetDetails(details []GetDetailsDetailParamsInterface, ctx context.Context, ...) (*GetDetailsResponse, *http.Response, error)
- func (r *TransfersResource) GetHistory(history *GetHistoryRequestParams, ctx context.Context, ...) (*GetHistoryResponse, *http.Response, error)
- type Transport
Constants ¶
const ( //ErrorCodeNotValidXmlRequest The sent XML are not valid, broken or has wrong format ErrorCodeNotValidXmlRequest uint64 = 40000 ErrorCodeUnauthorized uint64 = 40100 //ErrorCodeNotAcceptableTransfer //There is an error in the transfer operation ErrorCodeNotAcceptableTransfer uint64 = 40600 //ErrorCodeDetailRequestError //There is an error in the detail operation ErrorCodeDetailRequestError uint64 = 40700 //ErrorCodeHistoryRequestError //There is an error in the history operation ErrorCodeHistoryRequestError uint64 = 40800 //ErrorCodeBalanceRequestError //There is an error in the balance operation ErrorCodeBalanceRequestError uint64 = 40900 //ErrorMessageAccountRequestError //There is an error in the account operation ErrorCodeAccountRequestError uint64 = 41000 )
const ( //ErrorMessageNotValidXmlRequest The sent XML are not valid, broken or has wrong format ErrorMessageNotValidXmlRequest string = "NOT VALID XML REQUEST" ErrorMessageUnauthorized string = "UNAUTHORIZED" //ErrorMessageNotAcceptableTransfer There is an error in the transfer operation ErrorMessageNotAcceptableTransfer string = "NOT ACCEPTABLE TRANSFER" //ErrorMessageDetailRequestError There is an error in the detail operation ErrorMessageDetailRequestError string = "DETAIL REQUEST ERROR" //ErrorMessageHistoryRequestError There is an error in the history operation ErrorMessageHistoryRequestError string = "HISTORY REQUEST ERROR" //ErrorMessageBalanceRequestError There is an error in the balance operation ErrorMessageBalanceRequestError string = "BALANCE REQUEST ERROR" //ErrorMessageAccountRequestError There is an error in the account operation ErrorMessageAccountRequestError string = "ACCOUNT REQUEST ERROR" //ErrorMessageUnexpectedError Unexpected error ErrorMessageUnexpectedError string = "UNEXPECTED ERROR" )
const ProdAPIUrl = "https://api.fasapay.com"
ProdAPIUrl production ENV API url
const ProdAPIUrlSecond = "https://www.fasapay.com/xml"
ProdAPIUrlSecond production ENV API url
const SandboxAPIUrl = "https://sandbox.fasapay.com/xml"
SandboxAPIUrl sandbox ENV API url
const TransactionTypeExchange = "exchange"
TransactionTypeExchange const
const TransactionTypeReceive = "receive"
TransactionTypeReceive const
const TransactionTypeRedeem = "redeem"
TransactionTypeRedeem const
const TransactionTypeTopUp = "topup"
TransactionTypeTopUp const
const TransactionTypeTransfer = "transfer"
TransactionTypeTransfer const
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountsResource ¶
type AccountsResource struct {
ResourceAbstract
}
AccountsResource struct
func (*AccountsResource) GetAccounts ¶
func (r *AccountsResource) GetAccounts(accounts []string, ctx context.Context, attributes *RequestParamsAttributes) (*GetAccountsResponse, *http.Response, error)
GetAccounts method - allow you to check specific FasaPay account, to indicate is it registered or not.
Account request is used to get the information of certain FasaPay user by their account number.
Account request only needs account number of FasaPay account that you want to see.
Basic xml format for single account request:
<fasa_request id="1234567">
<auth> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <account>FP00001</account>
</fasa_request>
Basic xml format for batch accounts request:
<fasa_request id="1234567">
<auth><!-- authentication tag. required on every request --> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <account>FP00001</account> <account>FP00002</account>
</fasa_request>
func (*AccountsResource) GetBalances ¶
func (r *AccountsResource) GetBalances(currencies []CurrencyCode, ctx context.Context, attributes *RequestParamsAttributes) (*GetBalancesResponse, *http.Response, error)
GetBalances method - allow you to check your FasaPay account balance.
Balance request is used to get the amount of balance in your account.
Balance request only needs currency code of currency that you want to see. (IDR, USD)
Xml format for single balance request:
<fasa_request id="1234567">
<auth> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <balance>IDR</balance>
</fasa_request>
Xml format for batch balances request:
<fasa_request id="1234567">
<auth><!-- authentication tag. required on every request --> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <balance>IDR</balance> <balance>USD</balance>
</fasa_request>
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct
func NewClientFromConfig ¶
NewClientFromConfig Create new client from config
func (*Client) Transfers ¶
func (c *Client) Transfers() *TransfersResource
Transfers resource method
type Config ¶
type Config struct { Uri string `json:"api_uri"` ApiKey string `json:"api_key"` ApiSecretWord string `json:"api_secret_word"` }
Config structure
func NewConfigSandbox ¶
NewConfigSandbox Create new config from credentials (Sandbox version)
type CreateTransferRequest ¶
type CreateTransferRequest struct { RequestParams Transfers []*CreateTransferRequestParams `xml:"transfer" json:"transfers"` }
CreateTransferRequest struct
type CreateTransferRequestParams ¶
type CreateTransferRequestParams struct { XMLName xml.Name `xml:"transfer"` Id string `xml:"id,attr,omitempty" json:"id"` //id transfer for marking the transfer (max 50 character) To string `xml:"to" json:"to"` //is the FasaPay account target format: FPnnnnn Amount float64 `xml:"amount" json:"amount"` //is the amount of the transferred fund. with point (.) as the decimal separator Currency CurrencyCode `xml:"currency" json:"currency"` //is the currency used in the transfer (IDR | USD) FeeMode TransactionFeeMode `xml:"fee_mode,omitempty" json:"fee_mode"` //is Fee Mode used in the transfer. default to FiR (FiR | FiS) Note string `xml:"note,omitempty" json:"note"` //is note of the transfer (max 255 character) Ref string `xml:"ref,omitempty" json:"ref"` //Reference Code that can be used to track transaction (max 50 character) }
CreateTransferRequestParams struct
type CreateTransferResponse ¶
type CreateTransferResponse struct { ResponseBody Transfers []*CreateTransferResponseParams `xml:"transfer,omitempty" json:"transfers,omitempty"` }
CreateTransferResponse struct
type CreateTransferResponseParams ¶
type CreateTransferResponseParams struct { Mode string `xml:"mode,attr" json:"mode"` Code uint64 `xml:"code,attr" json:"code"` BatchNumber string `xml:"batchnumber" json:"batchnumber"` Date string `xml:"date" json:"date"` Time string `xml:"time" json:"time"` From string `xml:"from" json:"from"` To string `xml:"to" json:"to"` Fee float64 `xml:"fee" json:"fee"` Amount float64 `xml:"amount" json:"amount"` Total float64 `xml:"total" json:"total"` FeeMode string `xml:"fee_mode" json:"fee_mode"` Currency string `xml:"currency" json:"currency"` Note string `xml:"note" json:"note"` Status string `xml:"status" json:"status"` Type string `xml:"type" json:"type"` Balance float64 `xml:"balance" json:"balance"` Method string `xml:"method" json:"method"` }
CreateTransferResponseParams struct
type CurrencyCode ¶
type CurrencyCode string
CurrencyCode type
const CurrencyCodeIDR CurrencyCode = "IDR"
CurrencyCodeUSD const
const CurrencyCodeUSD CurrencyCode = "USD"
CurrencyCodeUSD const
type GetAccountsRequest ¶
type GetAccountsRequest struct { RequestParams Accounts []string `xml:"account" json:"accounts"` }
GetAccountsRequest struct
type GetAccountsResponse ¶
type GetAccountsResponse struct { ResponseBody Accounts []*GetAccountsResponseParams `xml:"account,omitempty" json:"accounts,omitempty"` }
GetAccountsResponse struct
type GetAccountsResponseParams ¶
type GetAccountsResponseParams struct { XMLName xml.Name `xml:"account" json:"-"` FullName string `xml:"fullname" json:"fullname"` Account string `xml:"account" json:"account"` Status string `xml:"status" json:"status"` }
GetAccountsResponseParams struct
type GetBalancesRequest ¶
type GetBalancesRequest struct { RequestParams Balances []CurrencyCode `xml:"balance" json:"balances"` }
GetBalancesRequest struct
type GetBalancesResponse ¶
type GetBalancesResponse struct { ResponseBody Balances *GetBalancesResponseParams `xml:"balance,omitempty" json:"balances,omitempty"` }
GetBalancesResponse struct
type GetBalancesResponseParams ¶
type GetBalancesResponseParams struct { IDR float64 `xml:"IDR" json:"IDR"` USD float64 `xml:"USD" json:"USD"` }
GetBalancesResponseParams struct
type GetDetailsDetailParamsInterface ¶
type GetDetailsDetailParamsInterface interface {
GetDetailType() string
}
GetDetailsDetailParamsInterface interface
type GetDetailsRequest ¶
type GetDetailsRequest struct { RequestParams Details []GetDetailsDetailParamsInterface `xml:"detail" json:"details"` }
GetDetailsRequest struct
type GetDetailsRequestDetailParamsString ¶
type GetDetailsRequestDetailParamsString string
GetDetailsRequestDetailParamsString struct
func (*GetDetailsRequestDetailParamsString) GetDetailType ¶
func (f *GetDetailsRequestDetailParamsString) GetDetailType() string
GetDetailType method implementation
type GetDetailsRequestDetailParamsStruct ¶
type GetDetailsRequestDetailParamsStruct struct { XMLName xml.Name `xml:"detail" json:"-"` Ref string `xml:"ref,omitempty" json:"ref,omitempty"` //REF parameter used to search for spesific fp_merchant_ref string that was saved by FasaPay during Transaction using SCI Note string `xml:"note,omitempty" json:"note,omitempty"` //NOTE Parameter used to search for spesific note string that was saved by FasaPay During Transaction. }
GetDetailsRequestDetailParamsStruct struct
func (*GetDetailsRequestDetailParamsStruct) GetDetailType ¶
func (f *GetDetailsRequestDetailParamsStruct) GetDetailType() string
GetDetailType method implementation
type GetDetailsResponse ¶
type GetDetailsResponse struct { ResponseBody Details []*GetDetailsResponseDetailParams `xml:"detail,omitempty" json:"details,omitempty"` }
GetDetailsResponse struct
type GetDetailsResponseDetailParams ¶
type GetDetailsResponseDetailParams struct { XMLName xml.Name `xml:"detail" json:"-"` Mode string `xml:"mode,attr" json:"mode"` Code uint64 `xml:"code,attr" json:"code"` BatchNumber string `xml:"batchnumber" json:"batchnumber"` Date string `xml:"date" json:"date"` Time string `xml:"time" json:"time"` From string `xml:"from" json:"from"` To string `xml:"to" json:"to"` Amount float64 `xml:"amount" json:"amount"` Total float64 `xml:"total" json:"total"` Currency string `xml:"currency" json:"currency"` Note string `xml:"note" json:"note"` Status string `xml:"status" json:"status"` Fee float64 `xml:"fee" json:"fee"` Type string `xml:"type" json:"type"` Method string `xml:"method" json:"method"` FeeMode string `xml:"fee_mod" json:"fee_mod"` }
GetDetailsResponseDetailParams struct
type GetHistoryRequest ¶
type GetHistoryRequest struct { RequestParams History *GetHistoryRequestParams `xml:"history" json:"history"` }
GetHistoryRequest struct
type GetHistoryRequestParams ¶
type GetHistoryRequestParams struct { StartDate string `xml:"start_date,omitempty" json:"start_date"` //for specify start date. format : YYYY-mm-dd example : 2011-03-01 EndDate string `xml:"end_date,omitempty" json:"end_date"` //for specify end date. format : YYYY-mm-dd example : 2011-03-01 Type TransactionType `xml:"type,omitempty" json:"type"` //for specify transaction type. (transfer|topup|redeem|exchange|receive) OrderBy string `xml:"order_by,omitempty" json:"order_by"` //for specify order/sort by specific parameters (sorting) (date|amount|to|from|currency|bank) Order string `xml:"order,omitempty" json:"order"` //specify order type (ASC|DESC) Page uint64 `xml:"page,omitempty" json:"page"` //for getting specific page from history transaction which has more than one page PageSize uint64 `xml:"page_size,omitempty" json:"page_size"` //for specify how much transaction per page (max 20) }
GetHistoryRequestParams struct
type GetHistoryResponse ¶
type GetHistoryResponse struct { ResponseBody History *GetHistoryResponseHistoryParams `xml:"history" json:"history"` }
GetHistoryResponse struct
type GetHistoryResponseDetailParams ¶
type GetHistoryResponseDetailParams struct { XMLName xml.Name `xml:"detail" json:"-"` BatchNumber string `xml:"batchnumber" json:"batchnumber"` Datetime string `xml:"datetime" json:"datetime"` Type string `xml:"type" json:"type"` To string `xml:"to" json:"to"` From string `xml:"from" json:"from"` Amount float64 `xml:"amount" json:"amount"` Note string `xml:"note" json:"note"` Status string `xml:"status" json:"status"` Currency string `xml:"currency" json:"currency"` Fee float64 `xml:"fee" json:"fee"` }
GetHistoryResponseDetailParams struct
type GetHistoryResponseHistoryParams ¶
type GetHistoryResponseHistoryParams struct { Page *GetHistoryResponsePageParams `xml:"page" json:"page"` Details []*GetHistoryResponseDetailParams `xml:"detail,omitempty" json:"details,omitempty"` }
GetHistoryResponseHistoryParams struct
type GetHistoryResponsePageParams ¶
type GetHistoryResponsePageParams struct { TotalItem uint64 `xml:"total_item" json:"total_item"` PageCount uint64 `xml:"page_count" json:"page_count"` CurrentPage uint64 `xml:"current_page" json:"current_page"` }
GetHistoryResponsePageParams struct
type RequestAuthParams ¶
type RequestAuthParams struct { XMLName xml.Name `xml:"auth" json:"-"` ApiKey string `xml:"api_key" json:"api_key"` Token string `xml:"token" json:"token"` }
RequestAuthParams struct
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
RequestBuilder handler
type RequestParams ¶
type RequestParams struct { XMLName xml.Name `xml:"fasa_request"` Id string `xml:"id,attr"` Auth *RequestAuthParams `xml:"auth" json:"auth"` }
RequestParams struct
type RequestParamsAttributes ¶
RequestParamsAttributes struct
type ResourceAbstract ¶
type ResourceAbstract struct {
// contains filtered or unexported fields
}
ResourceAbstract base resource
func NewResourceAbstract ¶
func NewResourceAbstract(transport *Transport, config *Config) ResourceAbstract
NewResourceAbstract Create new resource abstract
type ResponseBody ¶
type ResponseBody struct { XMLName xml.Name `xml:"fasa_response" json:"-"` Id string `xml:"id,attr" json:"id"` DateTime string `xml:"date_time,attr" json:"date_time"` Errors *ResponseBodyErrors `xml:"errors,omitempty" json:"errors,omitempty"` }
ResponseBody struct
type ResponseBodyErrorParams ¶
type ResponseBodyErrorParams struct { XMLName xml.Name `xml:"data" json:"-"` Code uint64 `xml:"code,omitempty" json:"code,omitempty"` Attribute string `xml:"attribute,omitempty" json:"attribute,omitempty"` Message string `xml:"message,omitempty" json:"message,omitempty"` Detail string `xml:"detail,omitempty" json:"detail,omitempty"` }
ResponseBodyErrorParams struct
type ResponseBodyErrors ¶
type ResponseBodyErrors struct { XMLName xml.Name `xml:"errors" json:"-"` Id string `xml:"id,attr,omitempty" json:"id,omitempty"` Mode string `xml:"mode,attr" json:"mode"` Code uint64 `xml:"code,attr" json:"code"` Data []*ResponseBodyErrorParams `xml:"data" json:"data"` }
ResponseBodyErrors struct
type TransactionFeeMode ¶
type TransactionFeeMode string
TransactionFeeMode type
const TransactionFeeModeFiR TransactionFeeMode = "FiR"
TransactionFeeModeFiR const
const TransactionFeeModeFiS TransactionFeeMode = "FiS"
TransactionFeeModeFiS const
type TransactionStatus ¶
type TransactionStatus string
TransactionStatus type
const TransactionStatusFinish TransactionStatus = "FINISH"
TransactionStatusFinish const
type TransfersResource ¶
type TransfersResource struct {
ResourceAbstract
}
TransfersResource struct
func (*TransfersResource) CreateTransfer ¶
func (r *TransfersResource) CreateTransfer(transfers []*CreateTransferRequestParams, ctx context.Context, attributes *RequestParamsAttributes) (*CreateTransferResponse, *http.Response, error)
CreateTransfer method - allow you to transfer fund from one account to another. With this command you may transfer any of the available currencies that FasaPay supports. This function also permits you to perform multiple (bulk) transfers.
Xml format of single transfer request:
<fasa_request id="1234567">
<auth> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <transfer id="tid"> <to>FP89680</to> <amount>1000.0</amount> <currency>idr</currency> <note>standart operation</note> </transfer>
</fasa_request>
Xml format of batch transfer request:
<fasa_request id="1234567">
<auth><!-- authentication tag. required on every request --> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <transfer id="tid-1"> <!-- transfer tag dan ididentifier --> <to>FP00001</to> <!-- akun tujuan--> <amount>1000.0</amount> <!-- jumlah yang ditransfer --> <currency>idr</currency> <!-- kurensi yang digunakan --> <note>note note</note> <!-- catatan --> </transfer> <transfer id="tid-2"> <to>FP00002</to> <amount>1000.0</amount> <currency>idr</currency> <note>no note</note> </transfer> <transfer id="tid-3"> <to>FP00003</to> <amount>1000.0</amount> <currency>idr</currency> <note></note> </transfer>
</fasa_request>
func (*TransfersResource) GetDetails ¶
func (r *TransfersResource) GetDetails(details []GetDetailsDetailParamsInterface, ctx context.Context, attributes *RequestParamsAttributes) (*GetDetailsResponse, *http.Response, error)
GetDetails method - allow you to receive detail information of specific transaction. You can include more than one of this command in single request.
Detail-Request is used to get the detailed transaction information.
Detail-Request only needs BATCHNUMBER of transactions that you want to see.
Detail-Request can also use this parameter to search for specific transaction:
ref, REF parameter used to search for specific fp_merchant_ref string that was saved by FasaPay during Transaction using SCI
note, NOTE Parameter used to search for specific note string that was saved by FasaPay During Transaction.
Xml format for simple detail request:
<fasa_request id="1234567">
<auth> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <detail>TR2012092712345</detail>
</fasa_request>
Xml format for simple detail request:
<fasa_request id="1234567">
<auth><!-- authentication tag. required on every request --> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <detail>TU2012092712345</detail> <detail>TR2012100265432</detail> <detail>TR2012092791234</detail> <detail><ref>BL12345</ref></detail> <detail><note>Pembayaran</note></detail>
</fasa_request>
func (*TransfersResource) GetHistory ¶
func (r *TransfersResource) GetHistory(history *GetHistoryRequestParams, ctx context.Context, attributes *RequestParamsAttributes) (*GetHistoryResponse, *http.Response, error)
GetHistory method - allow you to receive history transaction of your FasaPay account. this command has many additional parameter to filter the response like date range, currencies, type of transaction, account target, etc. Request history does not need any parameter to get 10 latest transactions
Basic xml format for history request:
<fasa_request id="1234567">
<auth><!-- authentication tag. required on every request --> <api_key>11123548cd3a5e5613325132112becf</api_key> <token>e910361e42dafdfd100b19701c2ef403858cab640fd699afc67b78c7603ddb1b</token> </auth> <history> <start_date>2011-07-01</start_date> <end_date>2011-07-09</end_date> <type>transfer</type> <order_by>date</order_by> <order>DESC</order> <page>3</page> <page_size>5</page_size> </history>
</fasa_request>
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport wrapper
func NewHttpTransport ¶
NewHttpTransport create new http transport