ammana

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

ammana-go

Unofficial Ammana SDK for Go Programming Language

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(baseUrl string, clientId string, clientSecret string, timeout time.Duration) *ammana

New Function, create ammana pointer Required parameter : 1. Your ClientID (this from Team Ammana) 2. Your ClientSecret (this from Team Ammana) 3. BaseURL (hit to endpoint ex: https://paylater-dev.ammana.id/api/v1 for sandbox or https://paylater.ammana.id/api/v1 for production. this value based on https://paylater-dev.ammana.id/docs/1.x/overview)

Types

type AmmanaService

type AmmanaService interface {
	// Get Authentication Method
	GetAuth() (DataAuth GenerateAccessTokenResponse, err error)
	// Get Card Detail Method
	GetCardDetail(request GetCardDetailRequest) (resp GetCardDetailResponse, err error)
	// Get Order URL Redirect to Ammana Method
	GetOrderURL(request OrderRequest) (resp OrderResponse, err error)
	// Get Detail Payment Method
	GetPaymentDetail(invoiceCode string) (resp GetPaymentDetailResponse, err error)
	// Set Order to Settlement Method
	SetSettleOrder(invoiceCode string) (resp SetSettlePaymentResponse, err error)
	// Set Order to Void Method
	SetVoidOrder(invoiceCode string) (resp SetVoidPaymentResponse, err error)
}

type GenerateAccessTokenRequest

type GenerateAccessTokenRequest struct {
	ClientSecret string `json:"client_secret"`
}

type GenerateAccessTokenResponse

type GenerateAccessTokenResponse struct {
	Data struct {
		AccessToken string `json:"access_token"`
		TokenType   string `json:"token_type"`
		ExpiresIn   int    `json:"expires_in"`
	} `json:"data"`
	Meta    SharedMeta `json:"meta"`
	Message string     `json:"message"`
	Type    string     `json:"type"`
}

type GetCardDetailRequest

type GetCardDetailRequest struct {
	PhoneNumber    string `json:"phone_number"`
	IdentityNumber string `json:"identity_number"`
}

type GetCardDetailResponse

type GetCardDetailResponse struct {
	Data struct {
		ID              string `json:"id"`
		Status          string `json:"status"`
		LimitAmount     int    `json:"limit_amount"`
		UsageAmount     int    `json:"usage_amount"`
		AvailableAmount int    `json:"available_amount"`
	} `json:"data"`
	Meta    SharedMeta `json:"meta"`
	Message string     `json:"message"`
	Type    string     `json:"type"`
}

type GetPaymentDetailResponse

type GetPaymentDetailResponse struct {
	Data struct {
		TransactionId string `json:"transaction_id"`
		Status        string `json:"status"`
		InvoiceCode   string `json:"invoice_code"`
		Total         int    `json:"total"`
		CreatedAt     string `json:"created_at"`
		PaidAt        string `json:"paid_at"`
	} `json:"data"`
	Meta    SharedMeta `json:"meta"`
	Message string     `json:"message"`
	Type    string     `json:"type"`
}

type OrderItem

type OrderItem struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Qty   int    `json:"qty"`
	Price int    `json:"price"`
	Total int    `json:"total"`
}

type OrderRequest

type OrderRequest struct {
	CardID       string      `json:"card_id"`
	ResponseType string      `json:"response_type"`
	InvoiceCode  string      `json:"invoice_code"`
	CallbackUrl  string      `json:"callback_url"`
	CancelUrl    string      `json:"cancel_url"`
	Items        []OrderItem `json:"items"`
}

type OrderResponse

type OrderResponse struct {
	Data struct {
		Url       string `json:"url"`
		ExpiresIn int    `json:"expires_in"`
	} `json:"data"`
	Meta    SharedMeta `json:"meta"`
	Message string     `json:"message"`
	Type    string     `json:"type"`
}

type SetSettlePaymentResponse

type SetSettlePaymentResponse struct {
	Data struct {
		TransactionId string `json:"transaction_id"`
		Status        string `json:"status"`
		InvoiceCode   string `json:"invoice_code"`
		Total         int    `json:"total"`
		CreatedAt     string `json:"created_at"`
		PaidAt        string `json:"paid_at"`
		SettledAt     string `json:"settled_at"`
	} `json:"data"`
	Meta    SharedMeta `json:"meta"`
	Message string     `json:"message"`
	Type    string     `json:"type"`
}

type SetVoidPaymentResponse

type SetVoidPaymentResponse struct {
	Data struct {
		TransactionId string `json:"transaction_id"`
		Status        string `json:"status"`
		InvoiceCode   string `json:"invoice_code"`
		Total         int    `json:"total"`
		CreatedAt     string `json:"created_at"`
		VoidAt        string `json:"void_at"`
	} `json:"data"`
	Meta    SharedMeta `json:"meta"`
	Message string     `json:"message"`
	Type    string     `json:"type"`
}

type SharedMeta

type SharedMeta struct {
	Hostname string `json:"hostname"`
	ClientIP string `json:"client_ip"`
}

type SharedRequest

type SharedRequest struct {
	ClientId    string `json:"client_id"`
	InvoiceCode string `json:"invoice_code"`
	PhoneNumber string `json:"phone_number"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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