common

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: 9 Imported by: 0

Documentation

Overview

* File Created: Saturday, 29th July 2023 10:39:48 pm * Author: Abdul Hamid (abdul.surel@gmail.com) * * Copyright (c) 2023 Author

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeaderIdempotencyKey

func HeaderIdempotencyKey(xIdempotencyKey, idempotencyKey string) map[string]string

HeaderIdempotencyKey returns X-Idempotency-Key & idempotency-key values for DurianPay idempotency purposes. Difference about X-Idempotency-Key and idempotency-key you can read on [Docs Idempotent] https://durianpay.id/docs/integration/disbursements/idempotent/

Types

type Api

type Api interface {
	Req(ctx context.Context, method string, url string, param any, body any, headers map[string]string, response any) *durianpay.Error
}

Api interface build for dependecy injection and testing.

type ApiImplement

type ApiImplement struct {
	ServerKey string
}

func NewAPI

func NewAPI(serverKey string) *ApiImplement

func (*ApiImplement) Req

func (c *ApiImplement) Req(ctx context.Context, method string, url string, param any, body any, headers map[string]string, response any) *durianpay.Error

Req is an http request made specifically to hit the DurianPay endpoint. If the HTTP status code returned is not 2xx then an error will be returned

Jump to

Keyboard shortcuts

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