-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpayment.go
61 lines (47 loc) · 2.4 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
61
// 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"
)
// ClientPayment interface
type ClientPayment interface {
Authorise(params *types.PaymentAuthoriseParams) (*types.PaymentAuthorise, error)
Authorise3d(params *types.PaymentAuthorise3dParams) (*types.PaymentAuthorise, error)
AuthoriseForRecurring(params *types.PaymentAuthoriseForRecurringParams) (*types.PaymentAuthorise, error)
AuthoriseRecurring(params *types.PaymentAuthoriseRecurringParams) (*types.PaymentAuthorise, error)
AuthoriseOneClick(params *types.PaymentAuthoriseOneClickParams) (*types.PaymentAuthorise, error)
}
// Authorise func
func (c Client) Authorise(params *types.PaymentAuthoriseParams) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", constants.APIPaymentV30), params, adyenPayment)
return adyenPayment, err
}
// Authorise3d func
func (c Client) Authorise3d(params *types.PaymentAuthorise3dParams) (*types.PaymentAuthorise, error) {
adyenPayment3d := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise3d", constants.APIPaymentV30), params, adyenPayment3d)
return adyenPayment3d, err
}
// AuthoriseForRecurring func
func (c Client) AuthoriseForRecurring(params *types.PaymentAuthoriseForRecurringParams) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", constants.APIPaymentV30), params, adyenPayment)
return adyenPayment, err
}
// AuthoriseRecurring func
func (c Client) AuthoriseRecurring(params *types.PaymentAuthoriseRecurringParams) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", constants.APIPaymentV30), params, adyenPayment)
return adyenPayment, err
}
// AuthoriseOneClick func
func (c Client) AuthoriseOneClick(params *types.PaymentAuthoriseOneClickParams) (*types.PaymentAuthorise, error) {
adyenPayment := &types.PaymentAuthorise{}
err := c.call("POST", fmt.Sprintf("/pal/servlet/Payment/%v/authorise", constants.APIPaymentV30), params, adyenPayment)
return adyenPayment, err
}