payment

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

* File Created: Tuesday, 5th September 2023 11:13:19 pm * Author: Abdul Hamid (abdul.surel@gmail.com) * * Copyright (c) 2023 Author

* File Created: Saturday, 9th September 2023 1:17:58 pm * Author: Abdul Hamid (abdul.surel@gmail.com) * * Copyright (c) 2023 Author

* File Created: Tuesday, 5th September 2023 11:13:37 pm * Author: Abdul Hamid (abdul.surel@gmail.com) * * Copyright (c) 2023 Author

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cancel

type Cancel struct {
	ID                 string            `json:"id"`
	OrderID            string            `json:"order_id"`
	PaymentRefID       string            `json:"payment_ref_id"`
	SettlementID       string            `json:"settlement_id"`
	PaymentDsRefID     string            `json:"payment_ds_ref_id"`
	Amount             string            `json:"amount"`
	Status             string            `json:"status"`
	IsLive             bool              `json:"is_live"`
	ExpirationDate     time.Time         `json:"expiration_date"`
	PaymentDetailsType string            `json:"payment_details_type"`
	MethodID           string            `json:"method_id"`
	CreatedAt          time.Time         `json:"created_at"`
	UpdatedAt          time.Time         `json:"updated_at"`
	Metadata           map[string]string `json:"metadata"`
	RetryCount         uint16            `json:"retry_count"`
	Discount           string            `json:"discount"`
	PaidAmount         string            `json:"paid_amount"`
	ProviderID         string            `json:"provider_id"`
	TotalFee           string            `json:"total_fee"`
	PromoID            string            `json:"promo_id"`
	ShippingFee        string            `json:"shipping_fee"`
	DsErrorMetadata    map[string]string `json:"ds_error_metadata"`
	FailureReason      map[string]string `json:"failure_reason"`
	SettlementStatus   string            `json:"settlement_status"`
}

Cancel represents for response Cancel Payment API.

type Capture

type Capture struct {
	PaymentID           string            `json:"payment_id"`
	OrderID             string            `json:"order_id"`
	PreauthorizedAmount string            `json:"preauthorized_amount"`
	AccountID           string            `json:"account_id"`
	PaidAmount          string            `json:"paid_amount"`
	Status              string            `json:"status"`
	CreatedAt           time.Time         `json:"created_at"`
	UpdatedAt           time.Time         `json:"updated_at"`
	Metadata            map[string]string `json:"metadata"`
}

Capture represents for response Payment Capture API.

type ChargeBNPL

type ChargeBNPL struct {
	Type     string             `json:"type"`
	Response chargeResponseBNPL `type:"response"`
}

ChargeBNPL use for response Payment Charge API (Buy Now PayLater)

type ChargeCard

type ChargeCard struct {
	Type     string             `json:"type"`
	Response chargeResponseCard `json:"response"`
}

ChargeCard use for response Payment Charge API (Card)

type ChargeEwallet

type ChargeEwallet struct {
	Type     string                `json:"type"`
	Response chargeResponseEwallet `json:"response"`
}

ChargeEwallet use for response Payment Charge API (E-Wallet)

type ChargeOnlineBank

type ChargeOnlineBank struct {
	Type     string                   `json:"type"`
	Response chargeResponseOnlineBank `json:"response"`
}

ChargeOnlineBank use for response Payment Charge API (Online Bank)

type ChargeQRIS

type ChargeQRIS struct {
	Type     string             `json:"type"`
	Response chargeResponseQRIS `json:"response"`
}

ChargeQRIS use for response Payment Charge API (QRIS)

type ChargeRetailStore

type ChargeRetailStore struct {
	Type     string                    `json:"type"`
	Response chargeResponseRetailStore `json:"response"`
}

ChargeRetailStore use for response Payment Charge API (Retail Store)

type ChargeVA

type ChargeVA struct {
	Type     string           `json:"type"`
	Response chargeResponseVA `json:""response`
}

ChargeVA use for response Payment Charge API (VA)

type CheckPaymentStatus

type CheckPaymentStatus struct {
	Status      string `json:"status"`
	IsCompleted bool   `json:"is_completed"`
	Signature   string `json:"signature"`
	ErrorCode   string `json:"error_code"`
}

CheckPaymentStatus represents for response Check Payments Status API.

type Client

type Client struct {
	ServerKey string
	Api       common.Api
}

func (*Client) Cancel

func (c *Client) Cancel(ctx context.Context, ID string) (*Cancel, *durianpay.Error)

Cancel returns a response from Cancel Payment API

[Doc Cancel Payment API]: https://durianpay.id/docs/api/payments/cancel/

func (*Client) Capture

Capture returns a response from Payment Capture API

[Doc Payment Capture API]: https://durianpay.id/docs/api/payments/capture/

func (*Client) ChargeBNPL

ChargeBNPL returns a response from Payment Charge API for Buy Now PayLater type

[Doc Payment Charge API BNPL]: https://durianpay.id/docs/api/payments/charge/

func (*Client) ChargeCard

ChargeCard returns a response from Payment Charge API for CARD type

[Doc Payment Charge API Online Bank]: https://durianpay.id/docs/api/payments/charge/

func (*Client) ChargeEwallet

ChargeEwallet returns a response from Payment Charge API for E-Wallet type

[Doc Payment Charge API E-Wallet]: https://durianpay.id/docs/api/payments/charge/

func (*Client) ChargeOnlineBank

ChargeOnlineBank returns a response from Payment Charge API for Online Banking type (ex: JeniusPay)

[Doc Payment Charge API Online Bank]: https://durianpay.id/docs/api/payments/charge/

func (*Client) ChargeQRIS

ChargeQRIS returns a response from Payment Charge API for QRIS type

[Doc Payment Charge API Online Bank]: https://durianpay.id/docs/api/payments/charge/

func (*Client) ChargeRetailStore

ChargeRetailStore returns a response from Payment Charge API for Retail Store type (ex: Indomaret / Alfamaret)

[Doc Payment Charge API Retail Store]: https://durianpay.id/docs/api/payments/charge/

func (*Client) ChargeVA

ChargeVA returns a response from Payment Charge API for Virtual Account type.

[Doc Payment Charge API VA]: https://durianpay.id/docs/api/payments/charge/

func (*Client) CheckPaymentStatus

func (c *Client) CheckPaymentStatus(ctx context.Context, ID string) (*CheckPaymentStatus, *durianpay.Error)

CheckPaymentStatus returns a response from Check Payments Status API.

[Doc Check Payments Status API]: https://durianpay.id/docs/api/payments/status/

func (*Client) FetchPaymentByID

func (c *Client) FetchPaymentByID(ctx context.Context, ID string, opt durianpay.PaymentFetchByIDOption) (*Payment, *durianpay.Error)

FetchPaymentByID returns a response from Payment Fetch by ID API.

[Doc Payment Fetch by ID API]: https://durianpay.id/docs/api/payments/fetch-one/

func (*Client) FetchPayments

FetchPayments returns a response from Payment Fetch API

[Doc Payment Fetch API]: https://durianpay.id/docs/api/payments/fetch/

func (*Client) MDRFeesCalculation

MDRFeesCalculation returns a response from MDR Fees Calculation API

[Doc https://durianpay.id/docs/api/payments/mdr-calculations/]

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, ID string, payload durianpay.PaymentVerifyPayload) (bool, *durianpay.Error)

Verify returns a response from Verify Payments Status API.

[Doc Verify Payments Status API]: https://durianpay.id/docs/api/payments/verify/

type FetchPayments

type FetchPayments struct {
	Payments []Payments `json:"payments"`
	Total    int        `json:"total"`
}

FetchPayments represents for response Payment Fetch API.

type MDRFee

type MDRFee struct {
	ActualAmount float32 `json:"actual_amount"`
	Fees         float32 `json:"fees"`
	TotalAmount  float32 `json:"total_amount"`
}

MDRFee is part of MDRFeesCalculation

type MDRFeesCalculation

type MDRFeesCalculation struct {
	GOPAY     MDRFee `json:"GOPAY"`
	DD_CIMB   MDRFee `json:"DD_CIMB"`
	QRIS      MDRFee `json:"QRIS"`
	SHOPEEPAY MDRFee `json:"SHOPEEPAY"`
	OTHERS    MDRFee `json:"OTHERS"`
	INDOMARET MDRFee `json:"INDOMARET"`
	BRI       MDRFee `json:"BRI"`
	ALFAMART  MDRFee `json:"ALFAMART"`
	JENIUSPAY MDRFee `json:"JENIUSPAY"`
	BCA       MDRFee `json:"BCA"`
	DD_BRI    MDRFee `json:"DD_BRI"`
	CARD      MDRFee `json:"CARD"`
	BNI       MDRFee `json:"BNI"`
	OVO       MDRFee `json:"OVO"`
	DANA      MDRFee `json:"DANA"`
	MANDIRI   MDRFee `json:"MANDIRI"`
	PERMATA   MDRFee `json:"PERMATA"`
	LINKAJA   MDRFee `json:"LINKAJA"`
	DANAMON   MDRFee `json:"DANAMON"`
	CIMB      MDRFee `json:"CIMB"`
	SYARIAH   MDRFee `json:"SYARIAH"`
}

MDRFeesCalculation represents for response MDR Fees Calculation API

type Payment

type Payment struct {
	ID                 string            `json:"id"`
	OrderID            string            `json:"order_id"`
	MerchantID         string            `json:"merchant_id"`
	PaymentRefID       string            `json:"payment_ref_id"`
	PaymentDsRefID     string            `json:"payment_ds_ref_id"`
	SettlementID       string            `json:"settlement_id"`
	Amount             string            `json:"amount"`
	Status             string            `json:"status"`
	IsLive             bool              `json:"is_live"`
	ExpirationDate     time.Time         `json:"expiration_date"`
	CreatedAt          time.Time         `json:"created_at"`
	UpdatedAt          time.Time         `json:"updated_at"`
	Customer           PaymentCustomer   `json:"customer"`
	Order              PaymentOrder      `json:"order"`
	Metadata           map[string]string `json:"metadata"`
	PaymentDetailsType string            `json:"payment_details_type"`
	MethodID           string            `json:"method_id"`
	Discount           string            `json:"discount"`
	PromoID            string            `json:"promo_id"`
	PaidAmount         string            `json:"paid_amount"`
	ShippingFee        string            `json:"shipping_fee"`
	FailureReason      map[string]string `json:"failure_reason"`
}

Payment represents for response Payment Fetch By ID API.

type PaymentCustomer

type PaymentCustomer struct {
	ID            string    `json:"id"`
	CustomerRefID string    `json:"customer_ref_id"`
	Email         string    `json:"email"`
	Mobile        string    `json:"mobile"`
	GivenName     string    `json:"given_name"`
	MiddleName    string    `json:"middle_name"`
	SurName       string    `json:"sur_name"`
	AddressLine1  string    `json:"address_line_1"`
	AddressLine2  string    `json:"address_line_2"`
	City          string    `json:"city"`
	Region        string    `json:"region"`
	Country       string    `json:"country"`
	PostalCode    string    `json:"postal_code"`
	CreatedAt     time.Time `json:"created_at"`
}

PaymentCustomer is part of Payment for attribute Customer

type PaymentOrder

type PaymentOrder struct {
	ID           string    `json:"id"`
	MerchantID   string    `json:"merchant_id"`
	CustomerID   string    `json:"customer_id"`
	OrderRefID   string    `json:"order_ref_id"`
	OrderDsRefID string    `json:"order_ds_ref_id"`
	Amount       string    `json:"amount"`
	Currency     string    `json:"currency"`
	Status       string    `json:"status"`
	IsLive       bool      `json:"is_live"`
	CreatedAt    time.Time `json:"created_at"`
}

PaymentOrder is part of Payment for attribute Order

type Payments

type Payments struct {
	ID                 string            `json:"id"`
	OrderID            string            `json:"order_id"`
	PaymentRefID       string            `json:"payment_ref_id"`
	SettlementID       string            `json:"settlement_id"`
	PaymentDsRefID     string            `json:"payment_ds_ref_id"`
	Amount             string            `json:"amount"`
	Status             string            `json:"status"`
	IsLive             bool              `json:"is_live"`
	ExpirationDate     time.Time         `json:"expiration_date"`
	PaymentDetailsType string            `json:"payment_details_type"`
	MethodID           string            `json:"method_id"`
	CreatedAt          time.Time         `json:"created_at"`
	UpdatedAt          time.Time         `json:"updated_at"`
	Metadata           map[string]string `json:"metadata"`
	RetryCount         uint16            `json:"retry_count"`
	Discount           string            `json:"discount"`
	PaidAmount         string            `json:"paid_amount"`
	ProviderID         string            `json:"provider_id"`
	TotalFee           string            `json:"total_fee"`
	PromoID            string            `json:"promo_id"`
	ShippingFee        string            `json:"shipping_fee"`
	DsErrorMetadata    map[string]string `json:"ds_error_metadata"`
	CustomerID         string            `json:"customer_id"`
	GivenName          string            `json:"given_name"`
	Email              string            `json:"email"`
	OrderRefID         string            `json:"order_ref_id"`
	Currency           string            `json:"currency"`
	FailureReason      map[string]string `json:"failure_reason"`
	SettlementStatus   string            `json:"settlement_status"`
}

Payments is part of FetchPayments for attribute payments.

Jump to

Keyboard shortcuts

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