Giter Club home page Giter Club logo

ayoconnect-api-go's Introduction

AyoConnect API

Installation

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

Config

ayoConfig := ayoconnect.Config{
    BaseUrl:      "{api_base_url}",
    ClientId:     "{your_client_id}",
    ClientSecret: "{your_client_secret}",
    MerchantCode: "{your_merchant_code}",
    Latitude:     "{default_latitude}",
    Longitude:    "{default_longitude}",
    PhoneNumber:  "{default_phone_number}",
    IpAddress:    "{default_ip_address}",
}

Base URL for Sandbox

https://sandbox.api.of.ayoconnect.id

Client

ayoClient := ayoconnect.New(&ayoConfig)

with existing access token

existingAccessToken := "{existing_access_token}"

ayoClient = ayoClient.WithAccessToken(existingAccessToken)

set correlation id manually

correlationId := "{your_correlation_id}"

ayoClient = ayoClient.WithRequestId(correlationId)

set correlation id automatically

ayoClient = ayoClient.WithAutoGeneratedRequestId()

set phone number

phoneNumber := "628xxx"

ayoClient = ayoClient.WithPhoneNumber(phoneNumber)

set ip address

ipAddress := "127.0.0.1"

ayoClient = ayoClient.WithIpAddress(ipAddress)

Authentication

authenticationResult, err = ayoClient.Authenticate()

if err != nil {
    // handle error
}

fmt.Println(authenticationResult.AccessToken)

Transfer API

Reference https://developer.ayoconnect.id/docs/bank-account-disbursement-stage/1/overview

  1. Get Balance
result, err := ayoClient.WithAutoGeneratedRequestId().GetBalance()

if err != nil {
    // handle error
}

fmt.Println(result.AccountInfo[0].AvailableBalance.Value)
  1. Add Beneficiary
transactionId := ayoClient.RandomString(32)

result, err := ayoClient.WithAutoGeneratedRequestId().AddBeneficiary(
    transactionId,
    "{bank_account_number}",
    "{bank_swift_code}",
)

if err != nil {
    // handle error
}

fmt.Println(result.BeneficiaryDetails.BeneficiaryId)
  1. Disburse
transactionId := ayoClient.RandomString(32)

result, err := ayoClient.WithAutoGeneratedRequestId().Disburse(
    transactionId,
    "{customer_id}",
    "{beneficiary_id}",
    "{amount_in_string}",
    "IDR",
    "{remark}",
)

if err != nil {
    // handle error
}

fmt.Println(result.ReferenceNumber)
  1. Get Disbursement Status using Correlation Id
result, err := ayoClient.WithAutoGeneratedRequestId().GetDisbursementStatusByCorrelationId(
    "{correlation_id}",
    "{transaction_id}",
    "{reference_number}",
    "{beneficicary_id}",
    "{customer_id}",
)

if err != nil {
    // handle error
}

fmt.Println(result.ReferenceNumber)

ayoconnect-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.