GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

mollie.*OnboardingService.SubmitOnboardingData   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
nop 2
1
package mollie
2
3
import (
4
	"context"
5
	"encoding/json"
6
	"time"
7
)
8
9
const onboardingURLPath = "v2/onboarding/me"
10
11
// OnboardingStatus describes status of the organization’s onboarding process.
12
type OnboardingStatus string
13
14
// Possible status values.
15
const (
16
	NeedsDataOnboardingStatus OnboardingStatus = "needs-data"
17
	InReviewOnboardingStatus  OnboardingStatus = "in-review"
18
	CompletedOnboardingStatus OnboardingStatus = "completed"
19
)
20
21
// OnboardingLinks contains URL objects relevant to the onboarding status.
22
type OnboardingLinks struct {
23
	Self          *URL `json:"self,omitempty"`
24
	Dashboard     *URL `json:"dashboard,omitempty"`
25
	Organization  *URL `json:"organization,omitempty"`
26
	Documentation *URL `json:"documentation,omitempty"`
27
}
28
29
// Onboarding data for an organization.
30
type Onboarding struct {
31
	CanReceivePayments    bool             `json:"canReceivePayments,omitempty"`
32
	CanReceiveSettlements bool             `json:"canReceiveSettlements,omitempty"`
33
	Resource              string           `json:"reference,omitempty"`
34
	Name                  string           `json:"name,omitempty"`
35
	SignedUpAt            *time.Time       `json:"signedUpAt,omitempty"`
36
	Status                OnboardingStatus `json:"status,omitempty"`
37
	Links                 OnboardingLinks  `json:"_links,omitempty"`
38
}
39
40
// OnboardingData request possible values.
41
//
42
// Please note that even though all parameters are optional,
43
// at least one of them needs to be provided in the request.
44
//
45
// Information that the merchant has entered in their dashboard will not be overwritten.
46
47 1
// OnboardingDataOrganization contains data of the organization you want to provide.
48 1
type OnboardingDataOrganization struct {
49 1
	Name               string   `json:"name,omitempty"`
50
	RegistrationNumber string   `json:"registrationNumber,omitempty"`
51
	VatNumber          string   `json:"vatNumber,omitempty"`
52 1
	VatRegulation      string   `json:"vatRegulation,omitempty"`
53 1
	Address            *Address `json:"address,omitempty"`
54
}
55
56 1
// OnboardingDataProfile contains data of the payment profile you want to provide.
57
type OnboardingDataProfile struct {
58
	Name             string           `json:"name,omitempty"`
59
	URL              string           `json:"url,omitempty"`
60
	Email            string           `json:"email,omitempty"`
61
	Description      string           `json:"description,omitempty"`
62
	Phone            string           `json:"phone,omitempty"`
63
	BusinessCategory BusinessCategory `json:"businessCategory,omitempty"`
64
}
65
66
// OnboardingData describes the information to be submitted.
67
type OnboardingData struct {
68
	Organization OnboardingDataOrganization `json:"organization,omitempty"`
69
	Profile      OnboardingDataProfile      `json:"profile,omitempty"`
70
}
71
72
// OnboardingService operates over the onboarding API.
73
type OnboardingService service
74
75
// GetOnboardingStatus gets the status of onboarding of the authenticated organization.
76
//
77
// See: https://docs.mollie.com/reference/get-onboarding-status
78
func (os *OnboardingService) GetOnboardingStatus(ctx context.Context) (res *Response, o *Onboarding, err error) {
79
	res, err = os.client.get(ctx, onboardingURLPath, nil)
80
	if err != nil {
81
		return
82
	}
83
84
	if err = json.Unmarshal(res.content, &o); err != nil {
85
		return
86
	}
87
88
	return
89
}
90
91
// SubmitOnboardingData sends data that will be prefilled in the merchant’s onboarding.
92
// Please note that the data you submit will only be processed when the onboarding status is needs-data.
93
//
94
// This endpoint has been deprecated. It will be supported for the foreseeable future, but new implementations should
95
// use the Create client link endpoint to create new clients and submit their organization’s details in one go.
96
//
97
// See: https://docs.mollie.com/reference/submit-onboarding-data
98
func (os *OnboardingService) SubmitOnboardingData(ctx context.Context, d *OnboardingData) (res *Response, err error) {
99 1
	res, err = os.client.post(ctx, onboardingURLPath, d, nil)
100 1
	if err != nil {
101 1
		return
102
	}
103
104 1
	return
105
}
106