Compare commits
1 Commits
developmen
...
1.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 18b22b4ea7 |
@ -34,7 +34,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
buildVersion = "1.3.1"
|
buildVersion = "1.3.2"
|
||||||
serviceName = "hardlink"
|
serviceName = "hardlink"
|
||||||
pollingFrequency = 8 * time.Second
|
pollingFrequency = 8 * time.Second
|
||||||
)
|
)
|
||||||
|
|||||||
@ -154,6 +154,8 @@ func (c *Client) waitForTerminalSession(ctx context.Context, terminalSessionID s
|
|||||||
ticker := time.NewTicker(time.Second)
|
ticker := time.NewTicker(time.Second)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
|
signatureRejected := false
|
||||||
|
|
||||||
for {
|
for {
|
||||||
session, err := c.getTerminalSession(ctx, terminalSessionID)
|
session, err := c.getTerminalSession(ctx, terminalSessionID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -163,13 +165,28 @@ func (c *Client) waitForTerminalSession(ctx context.Context, terminalSessionID s
|
|||||||
log.Println("session status:", session.Status)
|
log.Println("session status:", session.Status)
|
||||||
|
|
||||||
switch strings.ToLower(session.Status) {
|
switch strings.ToLower(session.Status) {
|
||||||
case types.ResultInitiateRequested, types.ResultInitiated, types.ResultAuthorized,
|
case types.ResultInitiateRequested, types.ResultInitiated, types.ResultAuthorized, types.ResultCancelRequested:
|
||||||
types.ResultCancelRequested, types.ResultSignatureRequired:
|
|
||||||
// Still processing. For this integration payment intents use captureMode Auto,
|
|
||||||
// so Authorized is expected to continue to Captured.
|
|
||||||
|
|
||||||
case types.ResultCaptured, types.ResultCancelled, types.ResultCanceled, types.ResultDeclined, types.ResultExpired,
|
case types.ResultSignatureRequired:
|
||||||
types.ResultSignatureAccepted, types.ResultSignatureRejected /*, types.ResultSignatureRequired*/ :
|
if !signatureRejected {
|
||||||
|
rejectedSession, err := c.rejectSignature(ctx, terminalSessionID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
signatureRejected = true
|
||||||
|
|
||||||
|
if rejectedSession != nil {
|
||||||
|
switch strings.ToLower(rejectedSession.Status) {
|
||||||
|
case types.ResultCaptured, types.ResultCancelled, types.ResultCanceled, types.ResultDeclined,
|
||||||
|
types.ResultExpired, types.ResultSignatureAccepted, types.ResultSignatureRejected:
|
||||||
|
return rejectedSession, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case types.ResultCaptured, types.ResultCancelled, types.ResultCanceled, types.ResultDeclined,
|
||||||
|
types.ResultExpired, types.ResultSignatureAccepted, types.ResultSignatureRejected:
|
||||||
return session, nil
|
return session, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -184,6 +201,21 @@ func (c *Client) waitForTerminalSession(ctx context.Context, terminalSessionID s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) rejectSignature(ctx context.Context, terminalSessionID string) (*terminalSessionResponse, error) {
|
||||||
|
payload := signatureVerificationRequest{
|
||||||
|
Accepted: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
var response terminalSessionResponse
|
||||||
|
path := "/terminal-sessions/" + url.PathEscape(terminalSessionID) + "/signature"
|
||||||
|
|
||||||
|
if err := c.doJSON(ctx, http.MethodPut, path, payload, true, &response); err != nil {
|
||||||
|
return nil, fmt.Errorf("reject Dojo signature verification: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &response, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) getTerminalSession(ctx context.Context, terminalSessionID string) (*terminalSessionResponse, error) {
|
func (c *Client) getTerminalSession(ctx context.Context, terminalSessionID string) (*terminalSessionResponse, error) {
|
||||||
var response terminalSessionResponse
|
var response terminalSessionResponse
|
||||||
path := "/terminal-sessions/" + url.PathEscape(terminalSessionID)
|
path := "/terminal-sessions/" + url.PathEscape(terminalSessionID)
|
||||||
@ -249,7 +281,10 @@ func (c *Client) baseResult(req paymentsvc.SaleRequest, details *paymentDetails)
|
|||||||
result.CardNumber = details.Card.CardNumber
|
result.CardNumber = details.Card.CardNumber
|
||||||
result.CardType = details.Card.CardType
|
result.CardType = details.Card.CardType
|
||||||
result.ExpiryDate = details.Card.ExpiryDate
|
result.ExpiryDate = details.Card.ExpiryDate
|
||||||
result.LastFourDigits = details.Card.CardNumber
|
result.LastFourDigits = details.Card.Last4PAN
|
||||||
|
if result.LastFourDigits == "" {
|
||||||
|
result.LastFourDigits = lastFour(details.Card.CardNumber)
|
||||||
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,10 @@ type terminalSessionSale struct {
|
|||||||
PaymentIntentID string `json:"paymentIntentId"`
|
PaymentIntentID string `json:"paymentIntentId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type signatureVerificationRequest struct {
|
||||||
|
Accepted bool `json:"accepted"`
|
||||||
|
}
|
||||||
|
|
||||||
type terminalSessionResponse struct {
|
type terminalSessionResponse struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
builtVersion is a const in main.go
|
builtVersion is a const in main.go
|
||||||
|
|
||||||
|
#### 1.3.2 - 20 July 2026
|
||||||
|
make dojo decline payment it case of signature required
|
||||||
|
|
||||||
#### 1.3.1 - 17 July 2026
|
#### 1.3.1 - 17 July 2026
|
||||||
added receipt printing functionality to the Dojo and Paybridge payment flow
|
added receipt printing functionality to the Dojo and Paybridge payment flow
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user