/
Base.go
41 lines (32 loc) · 818 Bytes
/
Base.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
package palpal
import (
"fmt"
"github.com/bennya8/go-union-payment/payloads"
)
type Gateway struct {
Base *Base
}
func (a *Gateway) Request(api payloads.UnionPaymentApi, params map[string]string) *payloads.UnionPaymentResult {
switch api {
}
return payloads.NewUnionPaymentResult(false, "unknown gateway api", nil)
}
type Base struct {
Config *Config
GatewayUrl string
}
func NewBase(config *Config) *Base {
b := &Base{}
b.Config = config
b.GatewayUrl = "https://api.paypal.com/"
if b.Config.UseSandbox {
b.GatewayUrl = "https://api.sandbox.paypal.com/"
}
return b
}
func (b *Base) GetFullGatewayUrl(method string) string {
return fmt.Sprintf(b.GatewayUrl, method)
}
func (b *Base) Request(uri string, params map[string]string) (*BaseResponse, error) {
return NewBaseResponse(""), nil
}