Giter Club home page Giter Club logo

flip-api-go's Introduction

Flip API

Installation

go get -u github.com/vannleonheart/flip-api-go

Config

flipConfig := flip.Config{
    BaseUrl:         "{flip_api_base_url}",
    ApiSecretKey:    "{your_flip_api_secret_key}",
    ValidationToken: "{your_flip_validation_token}",
}

Create Client

flipClient := flip.New(&flipConfig)

Get Balance

result, err := flipClient.GetBalance()

if err != nil {
    // handle error
}

fmt.Println(result.Balance)

Get All Bank Info

result, err := flipClient.GetBankInfo("")

if err != nil {
    // handle error
}

fmt.Println(len(result))

Get Single Bank Info

bankCode := "bca"

result, err := flipClient.GetBankInfo(bankCode)

if err != nil {
    // handle error
}

fmt.Println(len(result))

Is Maintenance

result, err := flipClient.IsMaintenance()

if err != nil {
    // handle error
}

fmt.Println(result.Maintenance)

Bank Account Inquiry

bankCode := "{flip_bank_code}"
bankAccountNo := "{target_bank_account_number}"

result, err := flipClient.BankAccountInquiry(bankCode, bankAccountNo, nil)

if err != nil {
    // handle error
}

fmt.Println(result.Status)

Create Disbursement

idempotencyKey := "{your_idempotency_key}"

testAmount := 100000

requestData := DisbursementRequest {
    AccountNumber: "{target_bank_account_number}",
    BankCode: "{flip_bank_code}",
    Amount: testAmount,
    Remark: "",
    RecipientCity: "",
    BeneficiaryEmail: "",
}

result, err := flipClient.CreateDisbursement(requestData, idempotencyKey)

if err != nil {
    // handle error
}

fmt.Println(result.Id)

Get Disbursement By Id

transactionId := "{flip_transaction_id}"

result, err := flipClient.GetDisbursementById(transactionId)

if err != nil {
    // handle error
}

fmt.Println(result.Status)

Get Disbursement By Idempotency Key

idempotencyKey := "{your_idempotency_key}"

result, err := flipClient.GetDisbursementByIdempotencyKey(idempotencyKey)

if err != nil {
    // handle error
}

fmt.Println(result.Status)

flip-api-go's People

Contributors

vannleonheart avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.