forked from mcornut/go-adyen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment.go
60 lines (46 loc) · 2.44 KB
/
payment.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
// 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/molotovtv/go-adyen/types"
)
// ClientPayment interface
type ClientPayment interface {
Authorise(params *types.PaymentAuthoriseParams, version string) (*types.PaymentAuthorise, error)
Authorise3d(params *types.PaymentAuthorise3dParams, version string) (*types.PaymentAuthorise, error)
AuthoriseForRecurring(params *types.PaymentAuthoriseForRecurringParams, version string) (*types.PaymentAuthorise, error)
AuthoriseRecurring(params *types.PaymentAuthoriseRecurringParams, version string) (*types.PaymentAuthorise, error)
AuthoriseOneClick(params *types.PaymentAuthoriseOneClickParams, version string) (*types.PaymentAuthorise, error)
}
// Authorise func
func (c Client) Authorise(params *types.PaymentAuthoriseParams, version string) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", version), params, adyenPayment)
return adyenPayment, err
}
// Authorise3d func
func (c Client) Authorise3d(params *types.PaymentAuthorise3dParams, version string) (*types.PaymentAuthorise, error) {
adyenPayment3d := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise3d", version), params, adyenPayment3d)
return adyenPayment3d, err
}
// AuthoriseForRecurring func
func (c Client) AuthoriseForRecurring(params *types.PaymentAuthoriseForRecurringParams, version string) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", version), params, adyenPayment)
return adyenPayment, err
}
// AuthoriseRecurring func
func (c Client) AuthoriseRecurring(params *types.PaymentAuthoriseRecurringParams, version string) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", version), params, adyenPayment)
return adyenPayment, err
}
// AuthoriseOneClick func
func (c Client) AuthoriseOneClick(params *types.PaymentAuthoriseOneClickParams, version string) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", version), params, adyenPayment)
return adyenPayment, err
}