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.
Passed
Pull Request — master (#42)
by Victor Hugo
01:30
created

mollie.*MiscellaneousService.ApplePaymentSession   A

Complexity

Conditions 4

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 11
dl 0
loc 16
c 0
b 0
f 0
ccs 10
cts 10
cp 1
crap 4
rs 9.85
nop 1
1
package mollie
2
3
import (
4
	"encoding/json"
5
	"net/http"
6
)
7
8
// MiscellaneousService operates over the resources described
9
// in Mollie's miscellaneous API endpoints section
10
type MiscellaneousService service
11
12
// ApplePaymentSession contains information about an Apple pay session
13
type ApplePaymentSession struct {
14
	EpochTimestamp    int    `json:"epochTimestamp,omitempty"`
15
	ExpiresAt         int    `json:"expiresAt,omitempty"`
16
	MerchantSessionID string `json:"merchantSessionIdentifier,omitempty"`
17
	Nonce             string `json:"nonce,omitempty"`
18
	MerchantID        string `json:"merchantIdentified,omitempty"`
19
	DomainName        string `json:"domainName,omitempty"`
20
	DisplayName       string `json:"displayName,omitempty"`
21
	Signature         string `json:"signature,omitempty"`
22
}
23
24
// ApplePaymentSessionRequest contains the body parameters for requesting
25
// a valid PaymentSession from Apple.
26
type ApplePaymentSessionRequest struct {
27
	Domain        string `json:"domain,omitempty"`
28
	ValidationURL string `json:"validationUrl,omitempty"`
29
}
30
31
// ApplePaymentSession returns an Apple Payment Session object valid for one transaction.
32
//
33
// See: https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session
34
func (ms *MiscellaneousService) ApplePaymentSession(asr *ApplePaymentSessionRequest) (aps *ApplePaymentSession, err error) {
35 1
	u := "v2/wallets/applepay/sessions"
36 1
	req, err := ms.client.NewAPIRequest(http.MethodPost, u, asr)
37 1
	if err != nil {
38 1
		return
39
	}
40
41 1
	res, err := ms.client.Do(req)
42 1
	if err != nil {
43 1
		return
44
	}
45
46 1
	if err = json.Unmarshal(res.content, &aps); err != nil {
47 1
		return
48
	}
49 1
	return
50
}
51