-
Notifications
You must be signed in to change notification settings - Fork 1
/
modification.go
71 lines (54 loc) · 2.93 KB
/
modification.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2018 Matthieu CORNUT-CHAUVINC. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package adyen
import (
"fmt"
"github.com/mcornut/go-adyen/constants"
"github.com/mcornut/go-adyen/types"
)
// ClientModification interface
type ClientModification interface {
Capture(params *types.ModificationCaptureParams) (*types.ModificationCapture, error)
Cancel(params *types.ModificationCancelParams) (*types.ModificationCancel, error)
Refund(params *types.ModificationRefundParams) (*types.ModificationRefund, error)
CancelOrRefund(params *types.ModificationCancelOrRefundParams) (*types.ModificationCancelOrRefund, error)
AdjustAuthorise(params *types.ModificationAdjustAuthoriseParams) (*types.ModificationAdjustAuthorise, error)
TechnicalCancel(params *types.ModificationTechnicalCancelParams) (*types.ModificationTechnicalCancelParams, error)
}
// Capture func
func (c Client) Capture(params *types.ModificationCaptureParams) (*types.ModificationCapture, error) {
adyenCapture := &types.ModificationCapture{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/capture", constants.APIPaymentV30), params, adyenCapture)
return adyenCapture, err
}
// Cancel func
func (c Client) Cancel(params *types.ModificationCancelParams) (*types.ModificationCancel, error) {
adyenCancel := &types.ModificationCancel{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/cancel", constants.APIPaymentV30), params, adyenCancel)
return adyenCancel, err
}
// Refund func
func (c Client) Refund(params *types.ModificationRefundParams) (*types.ModificationRefund, error) {
adyenRefund := &types.ModificationRefund{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/refund", constants.APIPaymentV30), params, adyenRefund)
return adyenRefund, err
}
// CancelOrRefund func
func (c Client) CancelOrRefund(params *types.ModificationCancelOrRefundParams) (*types.ModificationCancelOrRefund, error) {
adyenCancelOrRefund := &types.ModificationCancelOrRefund{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/cancelOrRefund", constants.APIPaymentV30), params, adyenCancelOrRefund)
return adyenCancelOrRefund, err
}
// AdjustAuthorise func
func (c Client) AdjustAuthorise(params *types.ModificationAdjustAuthoriseParams) (*types.ModificationAdjustAuthorise, error) {
adyenAdjustAuthorise := &types.ModificationAdjustAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/adjustAuthorisation", constants.APIPaymentV30), params, adyenAdjustAuthorise)
return adyenAdjustAuthorise, err
}
// TechnicalCancel func
func (c Client) TechnicalCancel(params *types.ModificationTechnicalCancelParams) (*types.ModificationTechnicalCancel, error) {
adyenTechnicalCancel := &types.ModificationTechnicalCancel{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/technicalCancel", constants.APIPaymentV30), params, adyenTechnicalCancel)
return adyenTechnicalCancel, err
}