flip

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

README

Go-Flip - Unofficial Flip Golang Interface

Descriptions

This package is interface for api https://docs.flip.id/, you only need to add ENV and add this package to your project.

Features

  1. Have collections of constants that used in the flip environment
  2. Easy to use, doesn't need to add authentication every function, the package handle it by getting it from ENV.

Endpoints

  • Generals
    • Get Balance
    • Get Bank Info
    • Is Maintenance
    • Bank Account Inquiry (failed testing)
  • Money Transfer
    • Create Disbursement
    • Get All Disbursement
    • Get Disbursement By Idempotency Key (failed testing)
    • Get Disbursement By ID (failed testing)
  • Special Money Transfer
    • Create Special Disbursement
    • City List
    • Country List
    • City and Country List
  • Agent Money Transfer
    • Create Disbursement for Agent
    • Get Agent Disbursement by ID
    • Get Agent Disbursement List
  • Agent Verification
    • Create Agent Identity
    • Update Agent Identity
    • Get Agent Identity
    • Upload Agent Identity Image
    • Upload Supporting Documents
    • KYC Submission
    • Repair Data
    • Repair Identity Image
    • Repair Identity Selfie Image
    • Get Country List
    • Get Province List
    • Get City List
    • Get District List
  • Accept Payment
    • Create Bill
    • Edit Bill
    • Get Bill
    • Get All Bills
    • Get Payment
    • Get All Payment
    • Confirm Bill Payment (ONLY FOR PRODUCTION)
  • International Transfer
    • Get Exchange Rates
    • Get Form Data
    • Create International Transfer C2C/C2B
    • Create International Transfer B2C/B2B (NOT FOUND need confirmation)
    • Get International Transfer
    • Get All International Transfer

TODO

  • Validation, flip already have validation on their end, but it will be more helpfull if we validate first before sending to flip
  • Documentations
  • Unit Tests

How To Use

Getting Flip

With Go module support, simply add the following import

import "github.com/fari-99/go-flip"

to your code, and then go [build|run|test] will automatically fetch the necessary dependencies.

Otherwise, run the following Go command to install the flip package:

$ go get -u github.com/fari-99/go-flip

Add Environment variable to your project

FLIP_ENVIRONMENT=dev
FLIP_SECRET_TOKEN="YOUR FLIP SECRET TOKEN"
FLIP_VALIDATION_TOKEN="YOUR FLIP VALIDATION TOKEN"
Example
Check if maintenance
package main

import (
	"encoding/json"
	"fmt"

	"github.com/fari-99/go-flip"
)

func main() {
	baseFlip := flip.NewBaseFlip()
	isMaintenance, err := baseFlip.IsMaintenance()
	if err != nil {
		fmt.Println(err.Error())
		errorMarshal, _ := json.MarshalIndent(baseFlip.GetErrorDetails(), "", " ")
		fmt.Println(string(errorMarshal))
		return
	}
	
	fmt.Printf("%+v", isMaintenance)
	return
}
Get Balance
package main

import (
	"encoding/json"
	"fmt"

	"github.com/fari-99/go-flip"
)

func main() {
	baseFlip := flip.NewBaseFlip()
	balance, err := baseFlip.GetBalance()
	if err != nil {
		fmt.Println(err.Error())
		errorMarshal, _ := json.MarshalIndent(baseFlip.GetErrorDetails(), "", " ")
		fmt.Println(string(errorMarshal))
		return
	}
	
	fmt.Printf("%+v", balance)
	return
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCallback

func CheckCallback(token string) (valid bool, err error)

func GenerateRSAKey

func GenerateRSAKey() (privateKey string, publicKey string, err error)

func GetSignature

func GetSignature(payload any) (signature string, err error)

Types

type BaseFlip

type BaseFlip struct {
	// contains filtered or unexported fields
}

func NewBaseFlip

func NewBaseFlip() *BaseFlip

func (*BaseFlip) ConfirmBillPayment

func (base *BaseFlip) ConfirmBillPayment(transactionID int64) (payment *models.ConfirmBillPaymentResponse, err error)

func (*BaseFlip) CreateAgentIdentity

func (base *BaseFlip) CreateAgentIdentity(formData models.CreateAgentIdentityRequest) (agentIdentity *models.CreateAgentIdentityResponse, err error)

func (*BaseFlip) CreateBill

func (base *BaseFlip) CreateBill(formData models.CreateBillRequest) (bill *models.CreateBillResponse, idempotencyKey string, err error)

func (*BaseFlip) CreateDisbursement

func (base *BaseFlip) CreateDisbursement(formData models.CreateDisbursementRequest) (responseModel *models.CreateDisbursementResponse, idempotencyKey string, err error)

func (*BaseFlip) CreateDisbursementAgent

func (base *BaseFlip) CreateDisbursementAgent(formData models.CreateDisbursementAgentRequest) (disbursement *models.CreateDisbursementAgentResponse, idempotencyKey string, err error)

func (*BaseFlip) CreateInternationalTransferB2CB2B

func (base *BaseFlip) CreateInternationalTransferB2CB2B(multipartData models.CreateInternationalTransferB2XRequest, multipartFile models.CreateInternationalTransferB2XFileRequest) (internationalTransfer *models.CreateInternationalTransferB2CB2BResponse, idempotencyKey string, err error)

func (*BaseFlip) CreateInternationalTransferC2CC2B

func (base *BaseFlip) CreateInternationalTransferC2CC2B(formData models.CreateInternationalTransferC2CC2BRequest) (internationalTransfer *models.CreateInternationalTransferC2CC2BResponse, idempotencyKey string, err error)

func (*BaseFlip) CreateSpecialDisbursement

func (base *BaseFlip) CreateSpecialDisbursement(formData models.CreateSpecialDisbursementRequest) (responseModel *models.CreateSpecialDisbursementResponse, idempotencyKey string, err error)

func (*BaseFlip) EditBill

func (base *BaseFlip) EditBill(billID int64, formData models.EditBillingRequest) (bill *models.EditBillingResponse, err error)

func (*BaseFlip) GetAgentIdentity

func (base *BaseFlip) GetAgentIdentity(agentID int64) (agentIdentity *models.GetAgentIdentityResponse, err error)

func (*BaseFlip) GetAllBill

func (base *BaseFlip) GetAllBill() (bills *models.GetAllBillingResponse, err error)

func (*BaseFlip) GetAllDisbursement

func (base *BaseFlip) GetAllDisbursement(params models.GetAllDisbursementRequest) (disbursements *models.GetAllDisbursementResponse, idempotencyKey string, err error)

func (*BaseFlip) GetAllInternationalTransfer

func (base *BaseFlip) GetAllInternationalTransfer(params models.GetAllInternationalTransferRequest) (internationalTransfers *models.GetAllInternationalTransferResponse, err error)

func (*BaseFlip) GetAllPayment

func (base *BaseFlip) GetAllPayment(params models.GetAllPaymentRequest) (payments *models.GetAllPaymentResponse, err error)

func (*BaseFlip) GetBalance

func (base *BaseFlip) GetBalance() (balanceModel *models.GetBalanceResponse, err error)

func (*BaseFlip) GetBankInfo

func (base *BaseFlip) GetBankInfo(params models.GetBankInfoRequest) (bankList *models.GetBankInfoResponse, err error)

func (*BaseFlip) GetBill

func (base *BaseFlip) GetBill(billID int64) (bill *models.EditBillingResponse, err error)

func (*BaseFlip) GetCityList

func (base *BaseFlip) GetCityList(uuid string, params models.LocationKycRequest) (locationData *models.LocationKycResponse, requestID string, err error)

func (*BaseFlip) GetCountryList

func (base *BaseFlip) GetCountryList(uuid string, params models.LocationKycRequest) (locationData *models.LocationKycResponse, requestID string, err error)

func (*BaseFlip) GetDisbursementAgentByID

func (base *BaseFlip) GetDisbursementAgentByID(transactionID int64) (disbursementModel *models.DisbursementModel, err error)

func (*BaseFlip) GetDisbursementAgentList

func (base *BaseFlip) GetDisbursementAgentList(params models.GetDisbursementAgentListRequest) (disbursementModel *models.GetDisbursementAgentListResponse, err error)

func (*BaseFlip) GetDisbursementById

func (base *BaseFlip) GetDisbursementById(disbursementID int64) (disbursementModel *models.DisbursementModel, err error)

func (*BaseFlip) GetDisbursementByIdemKey

func (base *BaseFlip) GetDisbursementByIdemKey(idempotencyKey string) (disbursementModel *models.DisbursementModel, err error)

func (*BaseFlip) GetDisbursementCityList

func (base *BaseFlip) GetDisbursementCityList() (cityList *models.CityListResponse, err error)

func (*BaseFlip) GetDisbursementCountryCityList

func (base *BaseFlip) GetDisbursementCountryCityList() (country *models.CountryCityListResponse, err error)

func (*BaseFlip) GetDisbursementCountryList

func (base *BaseFlip) GetDisbursementCountryList() (country *models.CountryListResponse, err error)

func (*BaseFlip) GetDistrictList

func (base *BaseFlip) GetDistrictList(uuid string, params models.LocationKycRequest) (locationData *models.LocationKycResponse, requestID string, err error)

func (*BaseFlip) GetErrorDetails

func (base *BaseFlip) GetErrorDetails() []constants.ErrorDetailModel

func (*BaseFlip) GetExchangeRate

func (base *BaseFlip) GetExchangeRate(params models.GetExchangeRatesRequest) (exchangeRates []models.GetExchangeRateResponse, err error)

func (*BaseFlip) GetFormData

func (base *BaseFlip) GetFormData(params models.GetFormDataRequest) (formData *models.GetFormDataResponse, err error)

func (*BaseFlip) GetIdempotencyKey

func (base *BaseFlip) GetIdempotencyKey() string

func (*BaseFlip) GetInternationalTransfer

func (base *BaseFlip) GetInternationalTransfer(transactionID int64) (internationalTransfer *models.GetInternationalTransferResponse, err error)

func (*BaseFlip) GetPayment

func (base *BaseFlip) GetPayment(billID int64, params models.GetPaymentRequest) (payments *models.GetPaymentResponse, err error)

func (*BaseFlip) GetProvinceList

func (base *BaseFlip) GetProvinceList(uuid string, params models.LocationKycRequest) (locationData *models.LocationKycResponse, requestID string, err error)

func (*BaseFlip) IsMaintenance

func (base *BaseFlip) IsMaintenance() (isMaintenance *models.GetMaintenanceStatusResponse, err error)

func (*BaseFlip) KYCSubmissions

func (base *BaseFlip) KYCSubmissions(agentID int64, uuid string, formData models.KycSubmissionRequest) (message *models.KycSubmissionResponse, requestID string, err error)

func (*BaseFlip) RepairData

func (base *BaseFlip) RepairData(agentID int64, uuid string, formData models.RepairDataRequest) (repairedData *models.RepairDataResponse, requestID string, err error)

func (*BaseFlip) RepairIdentityImage

func (base *BaseFlip) RepairIdentityImage(agentID int64, uuid string, multipartData models.RepairIdentityImageRequest, multipartFile models.RepairIdentityImageFileRequest) (repairedData *models.RepairDataResponse, requestID string, err error)

func (*BaseFlip) RepairIdentitySelfieImage

func (base *BaseFlip) RepairIdentitySelfieImage(agentID int64, uuid string, multipartData models.RepairIdentityImageRequest, multipartFile models.RepairIdentityImageFileRequest) (repairedData *models.RepairDataResponse, requestID string, err error)

func (*BaseFlip) SendBankAccountInquiry

func (base *BaseFlip) SendBankAccountInquiry(params models.SendBankAccountInquiryRequest) (inquiry *models.SendBankAccountInquiryResponse, err error)

func (*BaseFlip) SetIdempotencyKey

func (base *BaseFlip) SetIdempotencyKey(idemKey string) *BaseFlip

func (*BaseFlip) UpdateAgentIdentity

func (base *BaseFlip) UpdateAgentIdentity(agentID int64, formData models.UpdateAgentIdentityRequest) (identityModel *models.UpdateAgentIdentityResponse, err error)

func (*BaseFlip) UploadAgentIdentityImage

func (base *BaseFlip) UploadAgentIdentityImage(agentID int64, uuid string, multipartData models.UploadAgentIdentityRequest, multipartFile models.UploadAgentIdentityFileRequest) (imageFlip *models.UploadAgentIdentityResponse, requestID string, err error)

func (*BaseFlip) UploadSupportingDocuments

func (base *BaseFlip) UploadSupportingDocuments(uuid string, multipartData models.UploadSupportingDocumentsRequest, multipartFile models.UploadSupportingDocumentFilesRequest) (documents *models.UploadSupportingDocumentResponse, requestID string, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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