-
Notifications
You must be signed in to change notification settings - Fork 12
/
recurring_gateway.go
39 lines (29 loc) · 1.14 KB
/
recurring_gateway.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
package adyen
// RecurringGateway - Adyen recurring transaction logic
type RecurringGateway struct {
*Adyen
}
const (
// listRecurringDetailsType - listRecurringDetails type request, @TODO: move to enums
listRecurringDetailsType = "listRecurringDetails"
// disableRecurringType - disable recurring type request, @TODO: move to enums
disableRecurringType = "disable"
)
// ListRecurringDetails - Get list of recurring payments in Adyen
func (a *RecurringGateway) ListRecurringDetails(req *RecurringDetailsRequest) (*RecurringDetailsResult, error) {
url := a.adyenURL(RecurringService, listRecurringDetailsType, RecurringAPIVersion)
resp, err := a.execute(url, req)
if err != nil {
return nil, err
}
return resp.listRecurringDetails()
}
// DisableRecurring - disable customer's saved payment method based on a contract type or/and payment method ID
func (a *RecurringGateway) DisableRecurring(req *RecurringDisableRequest) (*RecurringDisableResponse, error) {
url := a.adyenURL(RecurringService, disableRecurringType, RecurringAPIVersion)
resp, err := a.execute(url, req)
if err != nil {
return nil, err
}
return resp.disableRecurring()
}