oy

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListEnableBank    = "002, 008, 009, 013, 022"
	DefaultListEnableEWallet = "shopeepay_ewallet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OyCallback

type OyCallback struct {
	PartnerTxID         string  `json:"partner_tx_id"`
	TxRefNumber         string  `json:"tx_ref_number"`
	Amount              float64 `json:"amount"`
	SenderName          string  `json:"sender_name"`
	SenderPhone         string  `json:"sender_phone"`
	SenderNote          string  `json:"sender_note"`
	Status              string  `json:"status"`
	SenderBank          string  `json:"sender_bank"`
	IsInvoice           bool    `json:"is_invoice"`
	PaidAmount          float64 `json:"paid_amount"`
	PaymentMethod       string  `json:"payment_method"`
	Description         string  `json:"description"`
	Email               string  `json:"email"`
	PaymentReceivedTime string  `json:"payment_received_time"`
	SettlementTime      string  `json:"settlement_time"`
	SettlementStatus    string  `json:"settlement_status"`
	SettlementType      string  `json:"settlement_type"`
	Created             string  `json:"created"`
	Updated             string  `json:"updated"`
	Expiration          string  `json:"expiration"`
}

type OyCreatePaymentEWalletCallback

type OyCreatePaymentEWalletCallback struct {
	Success            bool    `json:"success"`
	TrxID              string  `json:"trx_id"`
	CustomerID         string  `json:"customer_id"`
	Amount             float64 `json:"amount"`
	EwalletCode        string  `json:"ewallet_code"`
	MobileNumber       string  `json:"mobile_number"`
	SuccessRedirectURL string  `json:"success_redirect_url"`
	SettlementTime     string  `json:"settlement_time"`
	SettlementStatus   string  `json:"settlement_status"`
}

type OyCreatePaymentEWalletRequest

type OyCreatePaymentEWalletRequest struct {
	CustomerID         string `json:"customer_id"`
	PartnerTxID        string `json:"partner_trx_id"`
	SubMerchantID      string `json:"sub_merchant_id"`
	Amount             int64  `json:"amount"`
	Email              string `json:"email"`
	EwalletCode        string `json:"ewallet_code"`
	MobileNumber       string `json:"mobile_number"`
	SuccessRedirectURL string `json:"success_redirect_url"`
	ExpirationTime     int    `json:"expiration_time"`
}

type OyCreatePaymentEWalletResponse

type OyCreatePaymentEWalletResponse struct {
	Status struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
	EwalletTrxStatus string `json:"ewallet_trx_status"`
	Amount           int64  `json:"amount"`
	TrxID            string `json:"trx_id"`
	CustomerID       string `json:"customer_id"`
	PartnerTxID      string `json:"partner_trx_id"`
	EwalletCode      string `json:"ewallet_code"`
	EwalletURL       string `json:"ewallet_url"`
}

type OyCreatePaymentLinkRequest

type OyCreatePaymentLinkRequest struct {
	Description         string `json:"description"`
	PartnerTxID         string `json:"partner_tx_id"`
	Notes               string `json:"notes"`
	SenderName          string `json:"sender_name"`
	Amount              int64  `json:"amount"`
	Email               string `json:"email"`
	PhoneNumber         string `json:"phone_number"`
	IsOpen              bool   `json:"is_open"` // If is_open = TRUE and the amount parameter is defined, then a payer can pay any amount (greater than IDR 10,000) up to the defined amount. And in the case that is_open=false, then the amount and partner_tx_id parameters must be defined.
	Step                string `json:"step"`
	IncludeAdminFee     bool   `json:"include_admin_fee"`             // Admin fee will be added to the specified amount or amount inputted by user if this parameter is set as TRUE.
	ListDisabledPayment string `json:"list_disabled_payment_methods"` // To configure payment methods to be disabled (e.g. VA, CREDIT_CARD, QRIS, EWALLET, BANK_TRANSFER)
	ListEnabledBanks    string `json:"list_enabled_banks"`            // List of eligible bank codes: "002" (BRI), "008" (Mandiri), "009" (BNI), "013" (Permata), "022" (CIMB), "213" (SMBC), "213" (BSI), and "014" (BCA).
	ListEnabledEwallet  string `json:"list_enabled_ewallet"`          // List of eligible e-wallet: "shopeepay_ewallet", "dana_ewallet", "linkaja_ewallet", "ovo_ewallet"
	Expiration          string `json:"expiration"`                    // To set the expiration of the payment link (yyyy-MM-dd HH:mm:ss) e.g. 2022-12-31 23:59:59
}

type OyCreatePaymentLinkResponse

type OyCreatePaymentLinkResponse struct {
	PaymentLinkID string `json:"payment_link_id"`
	Message       string `json:"message"`
	EmailStatus   string `json:"email_status"`
	URL           string `json:"url"`
	Status        bool   `json:"status"`
}

type OyCreatePaymentVACallback

type OyCreatePaymentVACallback struct {
	VANumber          string  `json:"va_number"`
	Amount            float64 `json:"amount"`
	PartnerUserID     string  `json:"partner_user_id"`
	Success           bool    `json:"success"`
	TxDate            string  `json:"tx_date"`
	UsernameDisplay   string  `json:"username_display"`
	TrxExpirationDate string  `json:"trx_expiration_date"`
	PartnerTrxID      string  `json:"partner_trx_id"`
	TrxID             string  `json:"trx_id"`
	SettlementTime    string  `json:"settlement_time"`
	SettlementStatus  string  `json:"settlement_status"`
}

type OyCreatePaymentVARequest

type OyCreatePaymentVARequest struct {
	PartnerUserID     string `json:"partner_user_id"`
	BankCode          string `json:"bank_code"`
	Amount            int64  `json:"amount"`
	IsOpen            bool   `json:"is_open"`
	IsSingleUse       bool   `json:"is_single_use"`
	IsLifetime        bool   `json:"is_lifetime"`
	ExpirationTime    int64  `json:"expiration_time"`
	UsernameDisplay   string `json:"username_display"`
	Email             string `json:"email"`
	TrxExpirationTime int64  `json:"trx_expiration_time"`
	PartnerTrxID      string `json:"partner_trx_id"`
	TrxCounter        int64  `json:"trx_counter"`
}

type OyCreatePaymentVAResponse

type OyCreatePaymentVAResponse struct {
	ID     string `json:"id"`
	Status struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
	Amount                 float64 `json:"amount"`
	VANumber               string  `json:"va_number"`
	BankCode               string  `json:"bank_code"`
	IsOpen                 bool    `json:"is_open"`
	IsSingleUse            bool    `json:"is_single_use"`
	ExpirationTime         int64   `json:"expiration_time"`
	VAStatus               string  `json:"va_status"`
	UsernameDisplay        string  `json:"username_display"`
	PartnerUserID          string  `json:"partner_user_id"`
	CounterIncomingPayment int     `json:"counter_incoming_payment"`
	PartnerTrxID           string  `json:"partner_trx_id"`
	TrxExpirationTime      int64   `json:"trx_expiration_time"`
	TrxCounter             int     `json:"trx_counter"`
}

type OyPaymentResponse

type OyPaymentResponse struct {
	Success    bool        `json:"success"`
	Error      interface{} `json:"error"`
	Data       PaymentData `json:"data"`
	Reason     interface{} `json:"reason"`
	StatusCode int         `json:"status_code"`
}

type OyPaymentService

type OyPaymentService struct {
	Username    string
	APIKey      string
	Environment objects.EnvironmentType
	BaseURL     string
}

func NewOyPaymentService

func NewOyPaymentService(username, apiKey string, env objects.EnvironmentType) *OyPaymentService

NewOyPaymentService creates a new instance of OyPaymentService with the given username, api key, and environment. It sets the base URL for the Oy API based on the environment.

func (*OyPaymentService) CreatePaymentEWallet

func (o *OyPaymentService) CreatePaymentEWallet(dataPayment interface{}) (interface{}, error)

CreatePaymentEWallet creates an e-wallet payment request using the Oy API. It takes an interface{} as the dataPayment parameter, which should be of type OyCreatePaymentEWalletRequest. The function marshals the request data into JSON format and sends a POST request to the Oy API's "e-wallet-aggregator/create-transaction" endpoint. It sets the necessary headers for authentication. If the request is successful, it decodes the JSON response into an OyCreatePaymentEWalletResponse struct and returns it. In case of an error during marshaling, request creation, API call, or response decoding, an error is returned.

func (o *OyPaymentService) CreatePaymentLink(dataPayment interface{}) (interface{}, error)

CreatePaymentLink creates a payment link request using the Oy API. It takes an interface{} as the dataPayment parameter, which should be of type OyCreatePaymentLinkRequest. The function marshals the request data into JSON format and sends a POST request to the Oy API's "payment-checkout/create-v2" endpoint. It sets the necessary headers for authentication. If the request is successful, it decodes the JSON response into an OyCreatePaymentLinkResponse struct and returns it. In case of an error during marshaling, request creation, API call, or response decoding, an error is returned.

func (*OyPaymentService) CreatePaymentVA

func (o *OyPaymentService) CreatePaymentVA(dataPayment interface{}) (interface{}, error)

CreatePaymentVA creates a virtual account payment request using the Oy API. It takes an interface{} as the dataPayment parameter, which should be of type OyCreatePaymentVARequest. The function marshals the request data into JSON format and sends a POST request to the Oy API's "generate-static-va" endpoint. It sets the necessary headers for authentication. If the request is successful, it decodes the JSON response into an OyCreatePaymentVAResponse struct and returns it. In case of an error during marshaling, request creation, API call, or response decoding, an error is returned.

func (*OyPaymentService) DetailPayment

func (o *OyPaymentService) DetailPayment(data ...interface{}) (interface{}, error)

DetailPayment retrieves a payment status from the Oy API. The function takes a variadic interface{} parameter, where the first element should be a slice of interfaces containing the partner transaction ID as a string and a boolean indicating whether to send a callback or not. The function sends a GET request to the Oy API's "payment-checkout/status" endpoint to fetch the payment status. It sets the necessary headers for authentication. If the request is successful, it decodes the JSON response into an OyPaymentResponse struct and returns it. In case of an error during request creation, API call, or response decoding, an error is returned.

func (*OyPaymentService) DetailPaymentEWallet

func (o *OyPaymentService) DetailPaymentEWallet(data ...interface{}) (interface{}, error)

DetailPaymentEWallet retrieves details of an e-wallet payment using the Oy API. It takes a variadic interface{} parameter, where the first element should be a slice of interfaces containing the transaction ID as a string. The function sends a POST request to the Oy API's "e-wallet-aggregator/check-status" endpoint to fetch the payment details. It sets the necessary headers for authentication. If the request is successful, it decodes the JSON response into an OyCreatePaymentEWalletResponse struct and returns it. In case of an error during request creation, API call, or response decoding, an error is returned.

func (*OyPaymentService) DetailPaymentVA

func (o *OyPaymentService) DetailPaymentVA(data ...interface{}) (interface{}, error)

DetailPaymentVA retrieves details of a virtual account payment using the Oy API. It takes a variadic interface{} parameter, where the first element should be a slice of interfaces containing the virtual account ID as a string. The function sends a GET request to the Oy API's "static-virtual-account" endpoint to fetch the payment details. It sets the necessary headers for authentication. If the request is successful, it decodes the JSON response into an OyCreatePaymentVAResponse struct and returns it. In case of an error during request creation, API call, or response decoding, an error is returned.

type PaymentData

type PaymentData struct {
	PartnerTxID         string  `json:"partner_tx_id"`
	TxRefNumber         string  `json:"tx_ref_number"`
	Amount              float64 `json:"amount"`
	SenderName          string  `json:"sender_name"`
	SenderPhone         string  `json:"sender_phone"`
	SenderNote          string  `json:"sender_note"`
	Status              string  `json:"status"`
	SenderBank          string  `json:"sender_bank"`
	IsInvoice           bool    `json:"is_invoice"`
	PaidAmount          float64 `json:"paid_amount"`
	PaymentMethod       string  `json:"payment_method"`
	Description         string  `json:"description"`
	Email               string  `json:"email"`
	PaymentReceivedTime string  `json:"payment_received_time"`
	SettlementTime      string  `json:"settlement_time"`
	SettlementStatus    string  `json:"settlement_status"`
	SettlementType      string  `json:"settlement_type"`
	Created             string  `json:"created"`
	Updated             string  `json:"updated"`
	Expiration          string  `json:"expiration"`
}

Jump to

Keyboard shortcuts

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