xendit

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 9 Imported by: 24

README

Xendit API Go Client

go.dev reference Coverage Status Go Report Card

This library is the abstraction of Xendit API for access from applications written with Go.

Documentation

For the API documentation, check Xendit API Reference.

For the details of this library, see the GoDoc.

Installation

Install xendit-go with:

go get -u github.com/xendit/xendit-go

Then, import it using:

import (
    "github.com/xendit/xendit-go"
    "github.com/xendit/xendit-go/$product$"
)

with $product$ is the product of Xendit such as invoice and balance.

Go Module Support

This library supports Go modules by default. Simply require xendit-go in go.mod with a version like so:

module github.com/my/package

go 1.13

require (
  github.com/xendit/xendit-go v1.0.0
)

And use the same style of import paths as above:

import (
    "github.com/xendit/xendit-go"
    "github.com/xendit/xendit-go/$product$"
)

with $product$ is the product of Xendit such as invoice and balance.

Using xendit-go with $GOPATH

If you are still using $GOPATH and not planning to migrate to go mod, installing xendit-go would require installing its (only) dependency validator via

go get -u github.com/go-playground/validator

Please note that this means you are using master of validator and effectively miss out on its versioning that's gomod-based.

After installing validator, xendit-go can be installed normally.

Usage

The following pattern is applied throughout the library for a given $product$:

Without Client

If you're only dealing with a single secret key, you can simply import the packages required for the products you're interacting with without the need to create a client.

import (
    "github.com/xendit/xendit-go"
    "github.com/xendit/xendit-go/$product$"
)

// Setup
xendit.Opt.SecretKey = "examplesecretkey"

xendit.SetAPIRequester(apiRequester) // optional, useful for mocking

// Create
resp, err := $product$.Create($product$.CreateParams)

// Get
resp, err := $product$.Get($product$.GetParams)

// GetAll
resp, err := $product$.GetAll($product$.GetAllParams)
With Client

If you're dealing with multiple secret keys, it is recommended you use client.API. This allows you to create as many clients as needed, each with their own individual key.

import (
    "github.com/xendit/xendit-go"
    "github.com/xendit/xendit-go/client"
)

// Basic setup
xenCli := client.New("examplesecretkey")

// or with optional, useful-for-mocking `exampleAPIRequester`
xenCli := client.New("examplesecretkey").WithAPIRequester(exampleAPIRequester)

// Create
resp, err := xenCli.$product$.Create($product$.CreateParams)

// Get
resp, err := xenCli.$product$.Get($product$.GetParams)

// GetAll
resp, err := xenCli.$product$.GetAll($product$.GetAllParams)
Sub-Packages Documentations

The following is a list of pointers to documentations for sub-packages of xendit-go.

Contribute

For any requests, bugs, or comments, please open an issue or submit a pull request.

Test

After modifying the code, please make sure that the code passes all test cases.

Run all tests
go test ./...
Run tests for a package
go test ./invoice
Run a single test
go test ./invoice -run TestCreateInvoice
Run integration tests
SECRET_KEY=<your secret key> go run ./integration_test
Pre-commit

Before making any commits, please install pre-commit. To install pre-commit, follow the installation steps.

After installing the pre-commit, please install the needed dependencies:

make init

After the code passes everything, please submit a pull request.

Documentation

Overview

Package xendit provides the binding for Xendit APIs.

Index

Examples

Constants

View Source
const (
	// APIValidationErrCode error code for parameters validation
	APIValidationErrCode string = "API_VALIDATION_ERROR"
	// GoErrCode error code for errors happen inside Go code
	GoErrCode string = "GO_ERROR"
)

Contains constants for the ErrorCode in xendit.Error

Variables

This section is empty.

Functions

func SetAPIRequester

func SetAPIRequester(apiRequester APIRequester)

SetAPIRequester sets the APIRequester for API call

func SetHTTPClient

func SetHTTPClient(newHTTPClient *http.Client)

SetHTTPClient sets the httpClient for API call

Types

type APIRequester

type APIRequester interface {
	Call(ctx context.Context, method string, url string, secretKey string, header *http.Header, body interface{}, result interface{}) *Error
}

APIRequester abstraction of HTTP Client that will make API calls to Xendit backend. `body` is POST-requests' bodies if applicable. `result` pointer to value which response string will be unmarshalled to.

func GetAPIRequester

func GetAPIRequester() APIRequester

GetAPIRequester returns the xendit APIRequester. If it is already created, it will return the created one. Else, it will create a default implementation.

type APIRequesterImplementation

type APIRequesterImplementation struct {
	HTTPClient *http.Client
}

APIRequesterImplementation is the default implementation of APIRequester

func (*APIRequesterImplementation) Call

func (a *APIRequesterImplementation) Call(ctx context.Context, method string, url string, secretKey string, header *http.Header, body interface{}, result interface{}) *Error

Call makes HTTP requests with JSON-format body. `body` is POST-requests' bodies if applicable. `result` pointer to value which response string will be unmarshalled to.

type APIRequesterWrapper

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

APIRequesterWrapper is the APIRequester with locker for setting the APIRequester

type Balance

type Balance struct {
	Balance float64 `json:"balance"`
}

Balance contains data from Xendit's API response of balance related request. For more details see https://xendit.github.io/apireference/?bash#balances. For documentation of subpackage balance, checkout https://pkg.go.dev/github.com/xendit/xendit-go/balance

type BalanceAccountTypeEnum

type BalanceAccountTypeEnum string

BalanceAccountTypeEnum constants are the available balance account type

const (
	BalanceAccountTypeCash    BalanceAccountTypeEnum = "CASH"
	BalanceAccountTypeHolding BalanceAccountTypeEnum = "HOLDING"
	BalanceAccountTypeTax     BalanceAccountTypeEnum = "TAX"
)

This consists the values that BalanceAccountType can take

func (*BalanceAccountTypeEnum) String

func (b *BalanceAccountTypeEnum) String() string

String returns the BalanceAccountTypeEnum in type string

type BatchDisbursement

type BatchDisbursement struct {
	Created             *time.Time `json:"created"`
	Reference           string     `json:"reference"`
	TotalUploadedAmount float64    `json:"total_uploaded_amount"`
	TotalUploadedCount  int        `json:"total_uploaded_count"`
	Status              string     `json:"status"`
	ID                  string     `json:"id"`
}

BatchDisbursement contains data from Xendit's API response of batch disbursement. For more details see https://xendit.github.io/apireference/?bash#batch-disbursement.

type CardCharge

type CardCharge struct {
	ID                    string     `json:"id"`
	Status                string     `json:"status"`
	MerchantID            string     `json:"merchant_id"`
	Created               *time.Time `json:"created"`
	BusinessID            string     `json:"business_id"`
	AuthorizedAmount      float64    `json:"authorized_amount"`
	ExternalID            string     `json:"external_id"`
	MerchantReferenceCode string     `json:"merchant_reference_code"`
	ChargeType            string     `json:"charge_type"`
	CardBrand             string     `json:"card_brand"`
	MaskedCardNumber      string     `json:"masked_card_number"`
	CaptureAmount         float64    `json:"capture_amount,omitempty"`
	ECI                   string     `json:"eci,omitempty"`
	FailureReason         string     `json:"failure_reason,omitempty"`
	CardType              string     `json:"card_type,omitempty"`
	BankReconciliationID  string     `json:"bank_reconciliation_id,omitempty"`
	Descriptor            string     `json:"descriptor,omitempty"`
	MidLabel              string     `json:"mid_label,omitempty"`
	Currency              string     `json:"currency,omitempty"`
}

CardCharge contains data from Xendit's API response of card's charge related requests and Create Authorization request. For more details see https://xendit.github.io/apireference/?bash#create-charge and https://xendit.github.io/apireference/?bash#create-authorization. For documentation of subpackage card, checkout https://pkg.go.dev/github.com/xendit/xendit-go/card

type CardRefund

type CardRefund struct {
	ID                 string     `json:"id"`
	Updated            *time.Time `json:"updated"`
	Created            *time.Time `json:"created"`
	CreditCardChargeID string     `json:"credit_card_charge_id"`
	UserID             string     `json:"user_id"`
	Amount             float64    `json:"amount"`
	ExternalID         string     `json:"external_id"`
	Currency           string     `json:"currency"`
	Status             string     `json:"status"`
	FeeRefundAmount    float64    `json:"fee_refund_amount"`
	FailureReason      string     `json:"failure_reason"`
}

CardRefund contains data from Xendit's API response of card's Create Refund request. For more details see https://xendit.github.io/apireference/?bash#CreateRefund. For documentation of subpackage card, checkout https://pkg.go.dev/github.com/xendit/xendit-go/card

type CardReverseAuthorization

type CardReverseAuthorization struct {
	ID                 string     `json:"id"`
	ExternalID         string     `json:"external_id"`
	CreditCardChargeID string     `json:"credit_card_charge_id"`
	BusinessID         string     `json:"business_id"`
	Amount             float64    `json:"amount"`
	Status             string     `json:"status"`
	Created            *time.Time `json:"created"`
	Currency           string     `json:"currency,omitempty"`
}

CardReverseAuthorization contains data from Xendit's API response of card's Reverse Authorization request. For more details see https://xendit.github.io/apireference/?bash#reverse-authorization. For documentation of subpackage card, checkout https://pkg.go.dev/github.com/xendit/xendit-go/card

type CardlessCredit added in v0.2.0

type CardlessCredit struct {
	RedirectURL        string                 `json:"redirect_url"`
	TransactionID      string                 `json:"transaction_id"`
	OrderID            string                 `json:"order_id"`
	ExternalID         string                 `json:"external_id"`
	CardlessCreditType CardlessCreditTypeEnum `json:"cardless_credit_type"`
}

CardlessCredit contains data from Xendit's API response of cardless credit related requests. For more details see https://xendit.github.io/apireference/?bash#cardless-credit. For documentation of subpackage cardlesscredit, checkout https://pkg.go.dev/github.com/xendit/xendit-go/cardlesscredit

type CardlessCreditTypeEnum added in v0.2.0

type CardlessCreditTypeEnum string

CardlessCreditTypeEnum constants are the available cardless credit types

const (
	CardlessCreditTypeEnumKREDIVO CardlessCreditTypeEnum = "KREDIVO"
)

This consists the values that CardlessCreditTypeEnum can take

type Disbursement

type Disbursement struct {
	ID                      string   `json:"id"`
	UserID                  string   `json:"user_id"`
	ExternalID              string   `json:"external_id"`
	Amount                  float64  `json:"amount"`
	BankCode                string   `json:"bank_code"`
	AccountHolderName       string   `json:"account_holder_name"`
	DisbursementDescription string   `json:"disbursement_description"`
	Status                  string   `json:"status"`
	EmailTo                 []string `json:"email_to,omitempty"`
	EmailCC                 []string `json:"email_cc,omitempty"`
	EmailBCC                []string `json:"email_bcc,omitempty"`
	IsInstant               bool     `json:"is_instant,omitempty"`
	FailureCode             string   `json:"failure_code,omitempty"`
}

Disbursement contains data from Xendit's API response of disbursement related requests. For more details see https://xendit.github.io/apireference/?bash#disbursement. For documentation of subpackage disbursement, checkout https://pkg.go.dev/github.com/xendit/xendit-go/disbursement

Example (CreateWithClient)
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/xendit/xendit-go/client"
	"github.com/xendit/xendit-go/disbursement"
)

func main() {
	cli := client.New("xnd_...")

	availableBanks, err := cli.Disbursement.GetAvailableBanks()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("available disbursement banks: %+v\n", availableBanks)

	createData := disbursement.CreateParams{
		IdempotencyKey:    "disbursement" + time.Now().String(),
		ExternalID:        "disbursement-external",
		BankCode:          availableBanks[0].Code,
		AccountHolderName: "Michael Jackson",
		AccountNumber:     "1234567890",
		Description:       "Disbursement from Go",
		Amount:            200000,
	}

	resp, err := cli.Disbursement.Create(&createData)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("created disbursement: %+v\n", resp)
}
Output:

Example (CreateWithoutClient)
xendit.Opt.SecretKey = "xnd_..."

availableBanks, err := disbursement.GetAvailableBanks()
if err != nil {
	log.Fatal(err)
}
fmt.Printf("available disbursement banks: %+v\n", availableBanks)

createData := disbursement.CreateParams{
	IdempotencyKey:    "disbursement" + time.Now().String(),
	ExternalID:        "disbursement-external",
	BankCode:          availableBanks[0].Code,
	AccountHolderName: "Michael Jackson",
	AccountNumber:     "1234567890",
	Description:       "Disbursement from Go",
	Amount:            200000,
}

resp, err := disbursement.Create(&createData)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("created disbursement: %+v\n", resp)
Output:

type DisbursementBank

type DisbursementBank struct {
	Name            string `json:"name"`
	Code            string `json:"code"`
	CanDisburse     bool   `json:"can_disburse"`
	CanNameValidate bool   `json:"can_name_validate"`
}

DisbursementBank contains data from Xendit's API response of Get Disbursement Banks.

type EWallet

type EWallet struct {
	EWalletType          EWalletTypeEnum `json:"ewallet_type"`
	ExternalID           string          `json:"external_id"`
	Status               string          `json:"status"`
	Amount               float64         `json:"amount"`
	TransactionDate      *time.Time      `json:"transaction_date,omitempty"`
	CheckoutURL          string          `json:"checkout_url,omitempty"`
	BusinessID           string          `json:"business_id,omitempty"`
	Created              *time.Time      `json:"created,omitempty"`
	EWalletTransactionID string          `json:"e_wallet_transaction_id,omitempty"`
}

EWallet contains data from Xendit's API response of e-wallet related requests. For more details see https://xendit.github.io/apireference/?bash#ewallets. For documentation of subpackage ewallet, checkout https://pkg.go.dev/github.com/xendit/xendit-go/ewallet

type EWalletTypeEnum

type EWalletTypeEnum string

EWalletTypeEnum constants are the available e-wallet type

const (
	EWalletTypeOVO     EWalletTypeEnum = "OVO"
	EWalletTypeDANA    EWalletTypeEnum = "DANA"
	EWalletTypeLINKAJA EWalletTypeEnum = "LINKAJA"
)

This consists the values that EWalletTypeEnum can take

type Error

type Error struct {
	Status    int    `json:"status,omitempty"`
	ErrorCode string `json:"error_code,omitempty"`
	Message   string `json:"message,omitempty"`
}

Error is the conventional Xendit error

func FromGoErr

func FromGoErr(err error) *Error

FromGoErr generates xendit.Error from generic go errors

func FromHTTPErr

func FromHTTPErr(status int, respBody []byte) *Error

FromHTTPErr generates xendit.Error from http errors with non 2xx status

func (*Error) Error

func (e *Error) Error() string

Error returns error message. This enables xendit.Error to comply with Go error interface

func (*Error) GetErrorCode

func (e *Error) GetErrorCode() string

GetErrorCode returns error code coming from xendit backend

func (*Error) GetStatus

func (e *Error) GetStatus() int

GetStatus returns http status code

type Invoice

type Invoice struct {
	ID                        string                `json:"id"`
	Status                    string                `json:"status"`
	ExternalID                string                `json:"external_id"`
	UserID                    string                `json:"user_id"`
	PayerEmail                string                `json:"payer_email"`
	Description               string                `json:"description"`
	Amount                    float64               `json:"amount"`
	MerchantName              string                `json:"merchant_name"`
	MerchantProfilePictureURL string                `json:"merchant_profile_picture_url"`
	InvoiceURL                string                `json:"invoice_url"`
	ExpiryDate                *time.Time            `json:"expiry_date"`
	AvailableBanks            []InvoiceBank         `json:"available_banks,omitempty"`
	AvailableEWallets         []InvoiceEWallet      `json:"available_ewallets,omitempty"`
	AvailableRetailOutlets    []InvoiceRetailOutlet `json:"available_retail_outlets,omitempty"`
	ShouldExcludeCreditCard   bool                  `json:"should_exclude_credit_card"`
	ShouldSendEmail           bool                  `json:"should_send_email"`
	Created                   *time.Time            `json:"created"`
	Updated                   *time.Time            `json:"updated"`
	BankCode                  string                `json:"bank_code,omitempty"`
	PaidAmount                float64               `json:"paid_amount,omitempty"`
	AdjustedReceivedAmount    float64               `json:"adjusted_received_amount,omitempty"`
	RecurringPaymentID        string                `json:"recurring_payment_id,omitempty"`
	CreditCardChargeID        string                `json:"credit_card_charge_id,omitempty"`
	Currency                  string                `json:"currency,omitempty"`
	InitialCurrency           string                `json:"initial_currency,omitempty"`
	InitialAmount             string                `json:"initial_amount,omitempty"`
	PaidAt                    *time.Time            `json:"paid_at,omitempty"`
	MidLabel                  string                `json:"mid_label,omitempty"`
	PaymentChannel            string                `json:"payment_channel,omitempty"`
	PaymentMethod             string                `json:"payment_method,omitempty"`
	PaymentDestination        string                `json:"payment_destination,omitempty"`
	SuccessRedirectURL        string                `json:"success_redirect_url,omitempty"`
	FailureRedirectURL        string                `json:"failure_redirect_url,omitempty"`
	Items                     []InvoiceItem         `json:"items,omitempty"`
	FixedVA                   string                `json:"fixed_va,omitempty"`
}

Invoice contains data from Xendit's API response of invoice related requests. For more API details see https://xendit.github.io/apireference/?bash#invoices. For documentation of subpackage invoice, checkout https://pkg.go.dev/github.com/xendit/xendit-go/invoice

type InvoiceBank

type InvoiceBank struct {
	BankCode          string  `json:"bank_code"`
	CollectionType    string  `json:"collection_type"`
	BankAccountNumber string  `json:"bank_account_number"`
	TransferAmount    float64 `json:"transfer_amount"`
	BankBranch        string  `json:"bank_branch"`
	AccountHolderName string  `json:"account_holder_name"`
	IdentityAmount    int     `json:"identity_amount"`
}

InvoiceBank is data that contained in `Invoice` at AvailableBanks

type InvoiceEWallet

type InvoiceEWallet struct {
	EWalletType string `json:"ewallet_type"`
}

InvoiceEWallet is data that contained in `Invoice` at AvailableEWallets

type InvoiceItem

type InvoiceItem struct {
	Name     string  `json:"name"`
	Price    float64 `json:"price"`
	Quantity int     `json:"quantity"`
}

InvoiceItem is data that contained in `Invoice` at Items

type InvoiceRetailOutlet

type InvoiceRetailOutlet struct {
	RetailOutletName string  `json:"retail_outlet_name"`
	PaymentCode      string  `json:"payment_code"`
	TransferAmount   float64 `json:"transfer_amount"`
	MerchantName     string  `json:"merchant_name,omitempty"`
}

InvoiceRetailOutlet is data that contained in `Invoice` at AvailableRetailOutlets

type MissedPaymentActionEnum

type MissedPaymentActionEnum string

MissedPaymentActionEnum constants are the available recurring payment missed payment actions

const (
	MissedPaymentActionIgnore MissedPaymentActionEnum = "IGNORE"
	MissedPaymentActionStop   MissedPaymentActionEnum = "STOP"
)

This consists the values that MissedPaymentActionEnum can take

type Option

type Option struct {
	SecretKey string // customer's secret API key
	XenditURL string // should there be a need to override API base URL
}

Option is the wrap of the parameters needed for the API call

var Opt Option = Option{
	XenditURL: "https://api.xendit.co",
}

Opt is the default Option for the API call without API client

type PaymentTypeEnum added in v0.2.0

type PaymentTypeEnum string

PaymentTypeEnum constants are the available payment types

const (
	PaymentTypeEnum30Days   PaymentTypeEnum = "30_days"
	PaymentTypeEnum3Months  PaymentTypeEnum = "3_months"
	PaymentTypeEnum6Months  PaymentTypeEnum = "6_months"
	PaymentTypeEnum12Months PaymentTypeEnum = "12_months"
)

This consists the values that PaymentTypeEnum can take

type Payout

type Payout struct {
	ID                  string     `json:"id"`
	ExternalID          string     `json:"external_id"`
	Amount              float64    `json:"amount"`
	Status              string     `json:"status"`
	Email               string     `json:"email,omitempty"`
	PaymentID           string     `json:"payment_id,omitempty"`
	BankCode            string     `json:"bank_code,omitempty"`
	AccountHolderName   string     `json:"account_holder_name,omitempty"`
	AccountNumber       string     `json:"account_number,omitempty"`
	DisbursementID      string     `json:"disbursement_id,omitempty"`
	FailureReason       string     `json:"failure_reason,omitempty"`
	Created             *time.Time `json:"created,omitempty"`
	ExpirationTimestamp *time.Time `json:"expiration_timestamp,omitempty"`
	ClaimedTimestamp    *time.Time `json:"claimed_timestamp,omitempty"`
	FailedTimestamp     *time.Time `json:"failed_timestamp,omitempty"`
	MerchantName        string     `json:"merchant_name,omitempty"`
	PayoutURL           string     `json:"payout_url,omitempty"`
}

Payout contains data from Xendit's API response of invoice related request. For more details see https://xendit.github.io/apireference/?bash#payouts. For documentation of subpackage payout, checkout https://pkg.go.dev/github.com/xendit/xendit-go/payout

type RecurringPayment

type RecurringPayment struct {
	ID                    string                       `json:"id"`
	ExternalID            string                       `json:"external_id"`
	UserID                string                       `json:"user_id"`
	PayerEmail            string                       `json:"payer_email"`
	Description           string                       `json:"description"`
	Status                string                       `json:"status"`
	Amount                float64                      `json:"amount"`
	ShouldSendEmail       bool                         `json:"should_send_email"`
	Interval              RecurringPaymentIntervalEnum `json:"interval"`
	IntervalCount         int                          `json:"interval_count"`
	MissedPaymentAction   MissedPaymentActionEnum      `json:"missed_payment_action"`
	Created               *time.Time                   `json:"created"`
	Updated               *time.Time                   `json:"updated"`
	InvoiceDuration       int                          `json:"invoice_duration,omitempty"`
	StartDate             *time.Time                   `json:"start_date,omitempty"`
	LastCreatedInvoiceURL string                       `json:"last_created_invoice_url,omitempty"`
	CreditCardToken       string                       `json:"credit_card_token,omitempty"`
	SuccessRedirectURL    string                       `json:"success_redirect_url,omitempty"`
	FailureRedirectURL    string                       `json:"failure_redirect_url,omitempty"`
	TotalRecurrence       int                          `json:"total_recurrence,omitempty"`
	RecurrenceProgress    int                          `json:"recurrence_progress,omitempty"`
	Recharge              bool                         `json:"recharge,omitempty"`
	ChargeImmediately     bool                         `json:"charge_immediately,omitempty"`
}

RecurringPayment contains data from Xendit's API response of recurring payment related requests. For more details see https://xendit.github.io/apireference/?bash#recurring-payments. For documentation of subpackage recurringpayment, checkout https://pkg.go.dev/github.com/xendit/xendit-go/recurringpayment

type RecurringPaymentIntervalEnum

type RecurringPaymentIntervalEnum string

RecurringPaymentIntervalEnum constants are the available recurring payment intervals

const (
	RecurringPaymentIntervalDay   RecurringPaymentIntervalEnum = "DAY"
	RecurringPaymentIntervalWeek  RecurringPaymentIntervalEnum = "WEEK"
	RecurringPaymentIntervalMonth RecurringPaymentIntervalEnum = "MONTH"
)

This consists the values that RecurringPaymentIntervalEnum can take

type RetailOutlet

type RetailOutlet struct {
	IsSingleUse      bool                 `json:"is_single_use"`
	Status           string               `json:"status"`
	OwnerID          string               `json:"owner_id"`
	ExternalID       string               `json:"external_id"`
	RetailOutletName RetailOutletNameEnum `json:"retail_outlet_name"`
	Prefix           string               `json:"prefix"`
	Name             string               `json:"name"`
	PaymentCode      string               `json:"payment_code"`
	Type             string               `json:"type"`
	ExpectedAmount   float64              `json:"expected_amount"`
	ExpirationDate   *time.Time           `json:"expiration_date"`
	ID               string               `json:"id"`
}

RetailOutlet contains data from Xendit's API response of retail outlet related requests. For more details see https://xendit.github.io/apireference/?bash#retail-outlets. For documentation of subpackage retailoutlet, checkout https://pkg.go.dev/github.com/xendit/xendit-go/retailoutlet

type RetailOutletNameEnum

type RetailOutletNameEnum string

RetailOutletNameEnum constants are the available retail outlet names

const (
	RetailOutletNameAlfamart  RetailOutletNameEnum = "ALFAMART"
	RetailOutletNameIndomaret RetailOutletNameEnum = "INDOMARET"
)

This consists the values that RetailOutletNameEnum can take

type VirtualAccount

type VirtualAccount struct {
	OwnerID         string     `json:"owner_id"`
	ExternalID      string     `json:"external_id"`
	BankCode        string     `json:"bank_code"`
	MerchantCode    string     `json:"merchant_code"`
	Name            string     `json:"name"`
	AccountNumber   string     `json:"account_number"`
	IsClosed        *bool      `json:"is_closed"`
	ID              string     `json:"id"`
	IsSingleUse     *bool      `json:"is_single_use"`
	Status          string     `json:"status"`
	Currency        string     `json:"currency"`
	ExpirationDate  *time.Time `json:"expiration_date"`
	SuggestedAmount float64    `json:"suggested_amount,omitempty"`
	ExpectedAmount  float64    `json:"expected_amount,omitempty"`
	Description     string     `json:"description,omitempty"`
}

VirtualAccount contains data from Xendit's API response of virtual account related requests. For more details see https://xendit.github.io/apireference/?bash#virtual-accounts. For documentation of subpackage virtualaccount, checkout https://pkg.go.dev/github.com/xendit/xendit-go/virtualaccount

type VirtualAccountBank

type VirtualAccountBank struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

VirtualAccountBank contains data from Xendit's API response of Get Virtual Account Banks.

type VirtualAccountPayment

type VirtualAccountPayment struct {
	ID                       string     `json:"id"`
	PaymentID                string     `json:"payment_id"`
	CallbackVirtualAccountID string     `json:"callback_virtual_account_id"`
	ExternalID               string     `json:"external_id"`
	AccountNumber            string     `json:"account_number"`
	BankCode                 string     `json:"bank_code"`
	Amount                   float64    `json:"amount"`
	TransactionTimestamp     *time.Time `json:"transaction_timestamp"`
	MerchantCode             string     `json:"merchant_code"`
	Currency                 string     `json:"currency"`
}

VirtualAccountPayment contains data from Xendit's API response of Get Fixed Virtual Account Payment.

Directories

Path Synopsis
Package client provides a Xendit client for invoking APIs across all products
Package client provides a Xendit client for invoking APIs across all products
example
utils

Jump to

Keyboard shortcuts

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