-
Notifications
You must be signed in to change notification settings - Fork 19
/
sourceklarna.go
119 lines (101 loc) · 2.84 KB
/
sourceklarna.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package shared
import (
"encoding/json"
"fmt"
"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/pkg/utils"
)
// SourceKlarnaRegion - Base url region (For playground eu https://docs.klarna.com/klarna-payments/api/payments-api/#tag/API-URLs). Supported 'eu', 'us', 'oc'
type SourceKlarnaRegion string
const (
SourceKlarnaRegionEu SourceKlarnaRegion = "eu"
SourceKlarnaRegionUs SourceKlarnaRegion = "us"
SourceKlarnaRegionOc SourceKlarnaRegion = "oc"
)
func (e SourceKlarnaRegion) ToPointer() *SourceKlarnaRegion {
return &e
}
func (e *SourceKlarnaRegion) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "eu":
fallthrough
case "us":
fallthrough
case "oc":
*e = SourceKlarnaRegion(v)
return nil
default:
return fmt.Errorf("invalid value for SourceKlarnaRegion: %v", v)
}
}
type Klarna string
const (
KlarnaKlarna Klarna = "klarna"
)
func (e Klarna) ToPointer() *Klarna {
return &e
}
func (e *Klarna) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "klarna":
*e = Klarna(v)
return nil
default:
return fmt.Errorf("invalid value for Klarna: %v", v)
}
}
type SourceKlarna struct {
// A string which is associated with your Merchant ID and is used to authorize use of Klarna's APIs (https://developers.klarna.com/api/#authentication)
Password string `json:"password"`
// Propertie defining if connector is used against playground or production environment
Playground *bool `default:"false" json:"playground"`
// Base url region (For playground eu https://docs.klarna.com/klarna-payments/api/payments-api/#tag/API-URLs). Supported 'eu', 'us', 'oc'
Region SourceKlarnaRegion `json:"region"`
sourceType Klarna `const:"klarna" json:"sourceType"`
// Consists of your Merchant ID (eid) - a unique number that identifies your e-store, combined with a random string (https://developers.klarna.com/api/#authentication)
Username string `json:"username"`
}
func (s SourceKlarna) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(s, "", false)
}
func (s *SourceKlarna) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
return err
}
return nil
}
func (o *SourceKlarna) GetPassword() string {
if o == nil {
return ""
}
return o.Password
}
func (o *SourceKlarna) GetPlayground() *bool {
if o == nil {
return nil
}
return o.Playground
}
func (o *SourceKlarna) GetRegion() SourceKlarnaRegion {
if o == nil {
return SourceKlarnaRegion("")
}
return o.Region
}
func (o *SourceKlarna) GetSourceType() Klarna {
return KlarnaKlarna
}
func (o *SourceKlarna) GetUsername() string {
if o == nil {
return ""
}
return o.Username
}