fasapay

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 10 Imported by: 0

README

Fasapay XML API SDK GO (Unofficial)

Build Status Codecov Go Report Card Version Release License GoDoc Mentioned in Awesome Go

Description

Unofficial Fasapay payment gateway XML API Client for Go

API documentation

https://www.fasapay.com/en/apiguide/index

Installation

go get -u github.com/kachit/fasapay-sdk-go

Usage

package main

import (
    "fmt"
    "context"
    fasapay "github.com/kachit/fasapay-sdk-go"
)

func main(){
    // Create a client instance
    cfg := fasapay.NewConfig("Your API key", "Your API secret word")
    client, err := fasapay.NewClientFromConfig(cfg, nil)
    if err != nil {
        fmt.Printf("config parameter error " + err.Error())
        panic(err)
    }
}
Get balances list
ctx := context.Background()
currencies := []fasapay.CurrencyCode{fasapay.CurrencyCodeIDR, fasapay.CurrencyCodeUSD}
result, resp, err := client.Accounts().GetBalances(currencies, ctx, nil)

if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(response)

//Dump result
fmt.Println(result.Balances.IDR)
fmt.Println(result.Balances.USD)
Get accounts list
ctx := context.Background()
accounts := []string{"FP0000001", "FP0000002"}
result, resp, err := client.Accounts().GetAccounts(accounts, ctx, nil)

if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(response)

//Dump result
fmt.Println(result.Accounts[0].FullName)
fmt.Println(result.Accounts[0].Account)
fmt.Println(result.Accounts[0].Status)
Create transfer
ctx := context.Background()
transfer1 := &CreateTransferRequestParams{
		Id:       "123",
		To:       "FP89680",
		Amount:   1000.0,
		Currency: CurrencyCodeIDR,
		Note:     "standart operation",
	}

transfer2 := &CreateTransferRequestParams{
		Id:       "1234",
		To:       "FP89681",
		Amount:   1001.0,
		Currency: CurrencyCodeIDR,
		Note:     "standart operation",
	}
result, resp, err := client.Transfers().CreateTransfer([]*CreateTransferRequestParams{transfer, transfer2}, ctx, nil)

if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(response)

//Dump result
fmt.Println(result.Transfers[0].BatchNumber)
fmt.Println(result.Transfers[0].Datetime)
fmt.Println(result.Transfers[0].From)
fmt.Println(result.Transfers[0].To)
fmt.Println(result.Transfers[0].Amount)
fmt.Println(result.Transfers[0].Note)

fmt.Println(result.Transfers[1].BatchNumber)
fmt.Println(result.Transfers[1].Datetime)
fmt.Println(result.Transfers[1].From)
fmt.Println(result.Transfers[1].To)
fmt.Println(result.Transfers[1].Amount)
fmt.Println(result.Transfers[1].Note)
Get transfers history
ctx := context.Background()
history := &fasapay.GetHistoryRequestParams{StartDate: "2022-03-01", EndDate: "2022-03-28"}
result, resp, err := client.Transfers().GetHistory(history, ctx, nil)

if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(response)

//Dump result
fmt.Println(result.History.Page.TotalItem)
fmt.Println(result.History.Page.PageCount)
fmt.Println(result.History.Page.CurrentPage)

fmt.Println(result.History.Details[0].BatchNumber)
fmt.Println(result.History.Details[0].Datetime)
fmt.Println(result.History.Details[0].From)
fmt.Println(result.History.Details[0].To)
fmt.Println(result.History.Details[0].Amount)
fmt.Println(result.History.Details[0].Note)
Get transfers details
ctx := context.Background()
var detail1 fasapay.GetDetailsRequestDetailParamsString = "TR0000000001"
var detail2 fasapay.GetDetailsRequestDetailParamsString = "TR0000000002"
details := []fasapay.GetDetailsDetailParamsInterface{&detail1, &detail2}
result, resp, err := client.Transfers().GetDetails(details, ctx, nil)

if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(response)

//Dump result
fmt.Println(result.Details[0].BatchNumber)
fmt.Println(result.Details[0].Datetime)
fmt.Println(result.Details[0].From)
fmt.Println(result.Details[0].To)
fmt.Println(result.Details[0].Amount)
fmt.Println(result.Details[0].Note)

fmt.Println(result.Details[1].BatchNumber)
fmt.Println(result.Details[1].Datetime)
fmt.Println(result.Details[1].From)
fmt.Println(result.Details[1].To)
fmt.Println(result.Details[1].Amount)
fmt.Println(result.Details[1].Note)

Documentation

Index

Constants

View Source
const (
	//ErrorCodeNotValidXmlRequest The sent XML are not valid, broken or has wrong format
	ErrorCodeNotValidXmlRequest uint64 = 40000
	//ErrorCodeUnauthorized Authorisation failed.
	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
)
View Source
const (
	//ErrorMessageNotValidXmlRequest The sent XML are not valid, broken or has wrong format
	ErrorMessageNotValidXmlRequest string = "NOT VALID XML REQUEST"
	//ErrorMessageUnauthorized Authorisation failed.
	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"
)
View Source
const ProdAPIUrl = "https://api.fasapay.com"

ProdAPIUrl production ENV API url

View Source
const ProdAPIUrlSecond = "https://www.fasapay.com/xml"

ProdAPIUrlSecond production ENV API url

View Source
const SandboxAPIUrl = "https://sandbox.fasapay.com/xml"

SandboxAPIUrl sandbox ENV API url

View Source
const TransactionTypeExchange = "exchange"

TransactionTypeExchange const

View Source
const TransactionTypeReceive = "receive"

TransactionTypeReceive const

View Source
const TransactionTypeRedeem = "redeem"

TransactionTypeRedeem const

View Source
const TransactionTypeTopUp = "topup"

TransactionTypeTopUp const

View Source
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

func NewClientFromConfig(config *Config, cl *http.Client) (*Client, error)

NewClientFromConfig Create new client from config

func (*Client) Accounts

func (c *Client) Accounts() *AccountsResource

Accounts resource method

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 NewConfig

func NewConfig(apiKey string, apiSecretWord string) *Config

NewConfig Create new config from credentials (Prod version)

func NewConfigSandbox

func NewConfigSandbox(apiKey string, apiSecretWord string) *Config

NewConfigSandbox Create new config from credentials (Sandbox version)

func (*Config) IsSandbox

func (c *Config) IsSandbox() bool

IsSandbox check is sandbox environment

func (*Config) IsValid

func (c *Config) IsValid() error

IsValid check is valid config parameters

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

type RequestParamsAttributes struct {
	Id       string    `json:"id"`
	DateTime time.Time `json:"date_time"`
}

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

func (*ResponseBody) GetError

func (r *ResponseBody) GetError() string

GetError method

func (*ResponseBody) IsSuccess

func (r *ResponseBody) IsSuccess() bool

IsSuccess method

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 TransactionType

type TransactionType string

TransactionType type

type TransfersResource

type TransfersResource struct {
	ResourceAbstract
}

TransfersResource struct

func (*TransfersResource) CreateTransfer

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

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

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

func NewHttpTransport(config *Config, h *http.Client) *Transport

NewHttpTransport create new http transport

func (*Transport) SendRequest

func (tr *Transport) SendRequest(ctx context.Context, body []byte) (resp *http.Response, err error)

SendRequest Send request method

Jump to

Keyboard shortcuts

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