xendit

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEWalletChargeRequestFromInvoice added in v1.2.0

func NewEWalletChargeRequestFromInvoice(inv *invoice.Invoice) (*ewallet.CreateEWalletChargeParams, error)

NewEWalletChargeRequestFromInvoice create ewallet charge params for xendit ewallet API

func NewEwalletRequestFromInvoice deprecated

func NewEwalletRequestFromInvoice(inv *invoice.Invoice) (*ewallet.CreatePaymentParams, error)

Deprecated: NewEwalletRequestFromInvoice creates ewallet request for xendit

func NewInvoiceRequestFromInvoice

func NewInvoiceRequestFromInvoice(inv *invoice.Invoice) (*xinvoice.CreateParams, error)

func NewPaymentSource added in v0.5.0

func NewPaymentSource(s string) payment.PaymentType

NewPaymentSource converts xendit payment method to payment.PaymentType

func NewStatus added in v0.5.0

func NewStatus(s string) subscription.Status

NewStatus convert xendit status string to subscripiton status

Types

type DANAPaymentStatus

type DANAPaymentStatus struct {
	ExternalID        string  `json:"external_id"`
	Amount            float64 `json:"amount"`
	BusinessID        string  `json:"business_id"`
	EWalletType       string  `json:"ewallet_type"`
	PaymentStatus     string  `json:"payment_status"`
	TransactionDate   string  `json:"transaction_date"`
	CallbackAuthToken string  `json:"callback_authentication_token"`
}

DANAPaymentStatus stores the data sent by xendit while triggering any webhook for dana payment

func (DANAPaymentStatus) IsValid

func (s DANAPaymentStatus) IsValid(authKey string) error

IsValid checks whether the callback auth token sent by xendit matches the authentication token stored on the dashboard

type EWalletPaymentStatus added in v1.2.0

type EWalletPaymentStatus struct {
	Event             string                   `json:"event"`
	BusinessID        string                   `json:"business_id"`
	CreatedAt         time.Time                `json:"created"`
	Data              EWalletPaymentStatusData `json:"data"`
	CallbackAuthToken string                   `json:"callback_authentication_token"`
}

EWalletPaymentStatus stores callback information for xendit ewallet

func (EWalletPaymentStatus) IsValid added in v1.2.0

func (s EWalletPaymentStatus) IsValid(authKey string) error

type EWalletPaymentStatusData added in v1.2.0

type EWalletPaymentStatusData struct {
	ID                 string            `json:"id"`
	BusinessID         string            `json:"business_id"`
	ReferenceID        string            `json:"reference_id"`
	Status             string            `json:"status"`
	Currency           string            `json:"currency"`
	ChargeAmount       float64           `json:"charge_amount"`
	CaptureAmount      *float64          `json:"capture_amount"`
	ChannelCode        string            `json:"channel_code"`
	CheckoutMethod     string            `json:"checkout_method"`
	ChannelProperties  map[string]string `json:"channel_properties,omitempty"`
	Actions            map[string]string `json:"actions,omitempty"`
	IsRedirectRequired bool              `json:"is_redirect_required"`
	CallbackURL        string            `json:"callback_url"`
	CreatedAt          time.Time         `json:"created"`
	UpdatedAt          time.Time         `json:"updated"`
	VoidedAt           *time.Time        `json:"voided_at"`
	// CaptureNow *bool `json:"capture_now,omitempty"`
	CustomerID      *string                `json:"customer_id"`
	PaymentMethodID *string                `json:"payment_method_id"`
	Metadata        map[string]interface{} `json:"metadata"`
}

type Gateway

type Gateway struct {
	Ewallet   xEwallet
	Invoice   xInvoice
	Recurring xRecurring
	// contains filtered or unexported fields
}

Gateway ...

func NewGateway

func NewGateway(creds localconfig.APICredential) *Gateway

NewGateway creates new midtrans payment gateway

func (Gateway) NotificationValidationKey

func (g Gateway) NotificationValidationKey() string

NotificationValidationKey returns xendit callback authentication token

type InvoicePaymentStatus

type InvoicePaymentStatus struct {
	ID                     string  `json:"id"`
	ExternalID             string  `json:"external_id"`
	UserID                 string  `json:"user_id"`
	PaymentMethod          string  `json:"payment_method"`
	Status                 string  `json:"status"`
	MerchantName           string  `json:"merchant_name"`
	Amount                 float64 `json:"amount"`
	PaidAmount             float64 `json:"paid_amount"`
	BankCode               string  `json:"bank_code"`
	RetailOutletName       string  `json:"retail_outlet_name"`
	EwalletType            string  `json:"ewallet_type"`
	OnDemandLink           string  `json:"on_demand_link"`
	RecurringPaymentID     string  `json:"recurring_payment_id"`
	PaidAt                 string  `json:"paid_at"`
	PayerEmail             string  `json:"payer_email"`
	Description            string  `json:"description"`
	AdjustedReceivedAmount float64 `json:"adjusted_received_amount"`
	FeesPaidAmount         float64 `json:"fees_paid_amount"`
	CreatedAt              string  `json:"created"`
	UpdatedAt              string  `json:"updated"`
	Currency               string  `json:"currency"`
	PaymentChannel         string  `json:"payment_channel"`
	PaymentDestination     string  `json:"payment_destination"`
	CallbackAuthToken      string  `json:"-"`
}

InvoicePaymentStatus stores the data sent by xendit while triggering any webhook for xenInvoice https://xendit.github.io/apireference/#invoice-callback

func (InvoicePaymentStatus) IsValid

func (s InvoicePaymentStatus) IsValid(authKey string) error

IsValid always returns no error at least for now since we have no idea why xendit is not returning the callback token on the notification payload

type LinkAjaPaymentStatus

type LinkAjaPaymentStatus struct {
	ExternalID        string  `json:"external_id"`
	Amount            float64 `json:"amount"`
	Status            string  `json:"status"`
	EWalletType       string  `json:"ewallet_type"`
	CallbackAuthToken string  `json:"callback_authentication_token"`
}

LinkAjaPaymentStatus stores the data sent by xendit while triggering any webhook for linkaja payment

func (LinkAjaPaymentStatus) IsValid

func (s LinkAjaPaymentStatus) IsValid(authKey string) error

IsValid checks whether the callback auth token sent by xendit matches the authentication token stored on the dashboard

type OVOPaymentStatus

type OVOPaymentStatus struct {
	Event       string  `json:"event"`
	ID          string  `json:"id"`
	ExternalID  string  `json:"external_id"`
	BusinessID  string  `json:"business_id"`
	Phone       string  `json:"phone"`
	EWalletType string  `json:"ewallet_type"`
	Amount      float64 `json:"amount"`
	FailureCode string  `json:"failure_code"`
	Status      string  `json:"status"`
}

OVOPaymentStatus stores the data sent by xendit while triggering any webhook for ovo payment

func (OVOPaymentStatus) IsValid

func (s OVOPaymentStatus) IsValid(authKey string) error

IsValid always returns no error at least for now since we have no idea why xendit is not returning the callback token on the notification payload

Directories

Path Synopsis
ewallet
v1
v2

Jump to

Keyboard shortcuts

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