workflows

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const VAR_AGE = "age"
View Source
const VAR_IP = "ip"
View Source
const VAR_NAME = "name"

Variables

View Source
var StateApprove string = "Approve"
View Source
var StateApproveError string = "ApproveError"
View Source
var StateFinish string = "Finish"

Define a named string type

View Source
var StateGetIpData string = "StateGetIpData"

Define a named string type

View Source
var StateInit string = "Init"
View Source
var StateReview string = "Review"

Functions

This section is empty.

Types

type CheckPaymentResponse

type CheckPaymentResponse struct {
	Reference       string  `json:"reference"`
	PayNowReference string  `json:"paynowreference,omitempty"`
	Amount          float64 `json:"amount"`
	Status          string  `json:"status"`
	PollURL         string  `json:"pollurl,omitempty"`
	Hash            string  `json:"hash,omitempty"`
}

type DemoWorkflow

type DemoWorkflow struct {
	core.BaseWorkflow
}

func (*DemoWorkflow) Approve

func (m *DemoWorkflow) Approve() (*models.NextState, error)

func (*DemoWorkflow) Description

func (m *DemoWorkflow) Description() string

func (*DemoWorkflow) GetAllStates

func (m *DemoWorkflow) GetAllStates() []models.WorkflowState

func (*DemoWorkflow) GetRetryConfig

func (m *DemoWorkflow) GetRetryConfig() models.RetryConfig

func (*DemoWorkflow) GetStateVariables

func (m *DemoWorkflow) GetStateVariables() map[string]string

func (*DemoWorkflow) GetWorkflowData

func (m *DemoWorkflow) GetWorkflowData() *domain.Workflow

func (*DemoWorkflow) Init

func (m *DemoWorkflow) Init() (*models.NextState, error)

Each method returns the next state

func (*DemoWorkflow) InitialState

func (m *DemoWorkflow) InitialState() string

func (*DemoWorkflow) Review

func (m *DemoWorkflow) Review() (*models.NextState, error)

func (*DemoWorkflow) Setup

func (m *DemoWorkflow) Setup(wf *domain.Workflow)

func (*DemoWorkflow) StateTransitions

func (m *DemoWorkflow) StateTransitions() map[string][]string

type EnrollmentStruct

type EnrollmentStruct struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

type ExpressCheckoutRequest

type ExpressCheckoutRequest struct {
	Id             string   `json:"id"`
	Reference      string   `json:"reference"`
	AuthEmail      string   `json:"email,omitempty"`
	Amount         float64  `json:"amount"`
	Method         Provider `json:"method"`
	Phone          string   `json:"phone"`
	ReturnURL      string   `json:"returnurl,omitempty"`
	ResultURL      string   `json:"resulturl,omitempty"`
	AdditionalInfo string   `json:"additionalinfo,omitempty"`
	MerchantTrace  string   `json:"merchanttrace,omitempty"`
	Status         string   `json:"status,omitempty"`
	Hash           string   `json:"hash,omitempty"`
}

ExpressCheckoutRequest is the payload for creating an Express Checkout transaction.

type ExpressCheckoutResponse

type ExpressCheckoutResponse struct {
	Status          string `json:"status"`
	Instructions    string `json:"instructions,omitempty"`
	PayNowReference string `json:"paynowreference,omitempty"`
	PollURL         string `json:"pollurl,omitempty"`
	Hash            string `json:"hash,omitempty"`
	OtpReference    string `json:"otpreference,omitempty"`
	RemoteOtpUrl    string `json:"remoteotpurl,omitempty"`
}

ExpressCheckoutResponse represents the most relevant parts of the Paynow response.

type GetIpWorkflow

type GetIpWorkflow struct {
	core.BaseWorkflow
}

func (*GetIpWorkflow) Description

func (m *GetIpWorkflow) Description() string

func (*GetIpWorkflow) GetAllStates

func (m *GetIpWorkflow) GetAllStates() []models.WorkflowState

func (*GetIpWorkflow) GetRetryConfig

func (m *GetIpWorkflow) GetRetryConfig() models.RetryConfig

func (*GetIpWorkflow) GetStateVariables

func (m *GetIpWorkflow) GetStateVariables() map[string]string

func (*GetIpWorkflow) GetWorkflowData

func (m *GetIpWorkflow) GetWorkflowData() *domain.Workflow

func (*GetIpWorkflow) Init

func (m *GetIpWorkflow) Init() (*models.NextState, error)

Each method returns the next state

func (*GetIpWorkflow) InitialState

func (m *GetIpWorkflow) InitialState() string

func (*GetIpWorkflow) Setup

func (m *GetIpWorkflow) Setup(wf *domain.Workflow)

func (*GetIpWorkflow) StateGetIpData

func (m *GetIpWorkflow) StateGetIpData() (*models.NextState, error)

func (*GetIpWorkflow) StateTransitions

func (m *GetIpWorkflow) StateTransitions() map[string][]string

type MerchantTraceRequest

type MerchantTraceRequest struct {
	Id            string `json:"id"`
	MerchantTrace string `json:"merchanttrace,omitempty"`
	Status        string `json:"status,omitempty"`
	Hash          string `json:"hash,omitempty"`
}

type PaynowClient

type PaynowClient struct {
	IntegrationID  string
	IntegrationKey string

	HTTPClient *http.Client // optional
	// contains filtered or unexported fields
}

PaynowClient holds credentials and HTTP client configuration.

func NewClient

func NewClient(integrationID, integrationKey string) *PaynowClient

NewClient creates a Paynow client with sane defaults.

func (*PaynowClient) CreateExpressCheckout

func (c *PaynowClient) CreateExpressCheckout(ctx context.Context, req ExpressCheckoutRequest) (*ExpressCheckoutResponse, error)

CreateExpressCheckout creates an Express Checkout transaction for the given mobile wallet provider. It returns a response containing poll URL/redirect URL and status. The function is generic to support EcoCash, OneMoney, InnBucks, and O'mari (Omari).

func (*PaynowClient) GetMerchantTrace

func (c *PaynowClient) GetMerchantTrace(ctx context.Context, req MerchantTraceRequest) (*CheckPaymentResponse, error)

func (*PaynowClient) PollStatus

func (c *PaynowClient) PollStatus(ctx context.Context, pollUrl string) (*CheckPaymentResponse, error)

type Provider

type Provider string

Provider represents supported mobile wallet providers for Express Checkout. Valid values: Ecocash, Onemoney, InnBucks, Omari Paynow API typically expects specific method strings.

const (
	ProviderEcocash  Provider = "ECOCASH"
	ProviderOnemoney Provider = "ONEMONEY"
	ProviderInnBucks Provider = "INNBUCKS"
	ProviderOmari    Provider = "OMARI"
)

Jump to

Keyboard shortcuts

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