Repository: VictorAvelar/mollie-api-go
Pull request #338 (2024-03-08 16:01:21)

check wallets resources against api reference
<!--- Provide a general summary of your changes in the Title above -->

# Description

Ensures that the `wallets` resource delivers API parity. 

## Motivation and context

Ensures the library has full API parity.

## How has this been tested?

Please describe in detail how you tested your changes.

Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

- [x] Unit tests added / updated
- [x] The tests run on docker (using `make test`)
- [ ] The required `test data` has been added / updated

If you are running the tests locally, please specify:

- OS: macos
- Go version 1.22

## Types of changes

What types of changes does your code introduce? Put an `x` in all the boxes that apply:

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] This change requires a documentation update

## Checklist

Go over all the following points, and put an `x` in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your [tests and code style pass](https://help.github.com/articles/about-required-status-checks/).

- [x] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.
- [x] My pull request addresses exactly one patch/feature.
- [x] I have created a branch for this patch/feature.
- [x] Each individual commit in the pull request is meaningful.
- [x] If my change requires a change to the documentation, I have updated it accordingly.

<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->



Patch:
diff --git a/docs/README.md b/docs/README.md
index e798060..9588727 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -165,8 +165,6 @@ REST also implies a nice and clean structure for URLs or endpoints. This means y
   - [func \(ms \*MandatesService\) List\(ctx context.Context, customer string, options \*MandatesListOptions\) \(res \*Response, ml \*MandatesList, err error\)](<#MandatesService.List>)
   - [func \(ms \*MandatesService\) Revoke\(ctx context.Context, customer, mandate string\) \(res \*Response, err error\)](<#MandatesService.Revoke>)
 - [type MethodsLinks](<#MethodsLinks>)
-- [type MiscellaneousService](<#MiscellaneousService>)
-  - [func \(ms \*MiscellaneousService\) ApplePaymentSession\(ctx context.Context, asr \*ApplePaymentSessionRequest\) \(res \*Response, aps \*ApplePaymentSession, err error\)](<#MiscellaneousService.ApplePaymentSession>)
 - [type Mode](<#Mode>)
 - [type MollieConnectPaymentFields](<#MollieConnectPaymentFields>)
 - [type Onboarding](<#Onboarding>)
@@ -362,6 +360,8 @@ REST also implies a nice and clean structure for URLs or endpoints. This means y
 - [type UpdatePayment](<#UpdatePayment>)
 - [type UsedGiftCard](<#UsedGiftCard>)
 - [type UserAgentToken](<#UserAgentToken>)
+- [type WalletsService](<#WalletsService>)
+  - [func \(ms \*WalletsService\) ApplePaymentSession\(ctx context.Context, asr \*ApplePaymentSessionRequest\) \(res \*Response, aps \*ApplePaymentSession, err error\)](<#WalletsService.ApplePaymentSession>)
 
 
 ## Constants
@@ -437,7 +437,7 @@ type Amount struct {
 ```
 
 <a name="ApplePaymentSession"></a>
-## type [ApplePaymentSession](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/miscellaneous.go#L13-L22>)
+## type [ApplePaymentSession](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/wallets.go#L13-L22>)
 
 ApplePaymentSession contains information about an Apple pay session.
 
@@ -455,7 +455,7 @@ type ApplePaymentSession struct {
 ```
 
 <a name="ApplePaymentSessionRequest"></a>
-## type [ApplePaymentSessionRequest](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/miscellaneous.go#L26-L29>)
+## type [ApplePaymentSessionRequest](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/wallets.go#L26-L29>)
 
 ApplePaymentSessionRequest contains the body parameters for requesting a valid PaymentSession from Apple.
 
@@ -1384,7 +1384,7 @@ type Client struct {
     Captures       *CapturesService
     Subscriptions  *SubscriptionsService
     Customers      *CustomersService
-    Miscellaneous  *MiscellaneousService
+    Wallets        *WalletsService
     Mandates       *MandatesService
     Permissions    *PermissionsService
     Onboarding     *OnboardingService
@@ -2792,26 +2792,6 @@ type MethodsLinks struct {
 }
 ```
 
-<a name="MiscellaneousService"></a>
-## type [MiscellaneousService](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/miscellaneous.go#L10>)
-
-MiscellaneousService operates over the resources described in Mollie's miscellaneous API endpoints section.
-
-```go
-type MiscellaneousService service
-```
-
-<a name="MiscellaneousService.ApplePaymentSession"></a>
-### func \(\*MiscellaneousService\) [ApplePaymentSession](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/miscellaneous.go#L34-L38>)
-
-```go
-func (ms *MiscellaneousService) ApplePaymentSession(ctx context.Context, asr *ApplePaymentSessionRequest) (res *Response, aps *ApplePaymentSession, err error)
-```
-
-ApplePaymentSession returns an Apple Payment Session object valid for one transaction.
-
-See: https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session
-
 <a name="Mode"></a>
 ## type [Mode](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/common_types.go#L316>)
 
@@ -5659,4 +5639,24 @@ type UserAgentToken struct {
 }
 ```
 
+<a name="WalletsService"></a>
+## type [WalletsService](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/wallets.go#L10>)
+
+WalletsService operates over the resources described in Mollie's wallets API endpoints section.
+
+```go
+type WalletsService service
+```
+
+<a name="WalletsService.ApplePaymentSession"></a>
+### func \(\*WalletsService\) [ApplePaymentSession](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/wallets.go#L34-L38>)
+
+```go
+func (ms *WalletsService) ApplePaymentSession(ctx context.Context, asr *ApplePaymentSessionRequest) (res *Response, aps *ApplePaymentSession, err error)
+```
+
+ApplePaymentSession returns an Apple Payment Session object valid for one transaction.
+
+See: https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session
+
 Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
diff --git a/mollie/mollie.go b/mollie/mollie.go
index 1a1d01c..f3b2f44 100644
--- a/mollie/mollie.go
+++ b/mollie/mollie.go
@@ -63,7 +63,7 @@ type Client struct {
 	Captures       *CapturesService
 	Subscriptions  *SubscriptionsService
 	Customers      *CustomersService
-	Miscellaneous  *MiscellaneousService
+	Wallets        *WalletsService
 	Mandates       *MandatesService
 	Permissions    *PermissionsService
 	Onboarding     *OnboardingService
@@ -299,7 +299,7 @@ func NewClient(baseClient *http.Client, conf *Config) (mollie *Client, err error
 	mollie.Settlements = (*SettlementsService)(&mollie.common)
 	mollie.Subscriptions = (*SubscriptionsService)(&mollie.common)
 	mollie.Customers = (*CustomersService)(&mollie.common)
-	mollie.Miscellaneous = (*MiscellaneousService)(&mollie.common)
+	mollie.Wallets = (*WalletsService)(&mollie.common)
 	mollie.Mandates = (*MandatesService)(&mollie.common)
 	mollie.Permissions = (*PermissionsService)(&mollie.common)
 	mollie.Onboarding = (*OnboardingService)(&mollie.common)
diff --git a/mollie/miscellaneous.go b/mollie/wallets.go
similarity index 83%
rename from mollie/miscellaneous.go
rename to mollie/wallets.go
index f1921ba..bc429ed 100644
--- a/mollie/miscellaneous.go
+++ b/mollie/wallets.go
@@ -5,9 +5,9 @@ import (
 	"encoding/json"
 )
 
-// MiscellaneousService operates over the resources described
-// in Mollie's miscellaneous API endpoints section.
-type MiscellaneousService service
+// WalletsService operates over the resources described
+// in Mollie's wallets API endpoints section.
+type WalletsService service
 
 // ApplePaymentSession contains information about an Apple pay session.
 type ApplePaymentSession struct {
@@ -31,7 +31,7 @@ type ApplePaymentSessionRequest struct {
 // ApplePaymentSession returns an Apple Payment Session object valid for one transaction.
 //
 // See: https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session
-func (ms *MiscellaneousService) ApplePaymentSession(ctx context.Context, asr *ApplePaymentSessionRequest) (
+func (ms *WalletsService) ApplePaymentSession(ctx context.Context, asr *ApplePaymentSessionRequest) (
 	res *Response,
 	aps *ApplePaymentSession,
 	err error,


Test patch:
diff --git a/mollie/miscellaneous_test.go b/mollie/wallets_test.go
similarity index 95%
rename from mollie/miscellaneous_test.go
rename to mollie/wallets_test.go
index 0bab18d..09be8bc 100644
--- a/mollie/miscellaneous_test.go
+++ b/mollie/wallets_test.go
@@ -91,7 +91,7 @@ func TestMiscellaneousService_ApplePaymentSession(t *testing.T) {
 			c.pre()
 			tMux.HandleFunc("/v2/wallets/applepay/sessions", c.handler)
 
-			res, m, err := tClient.Miscellaneous.ApplePaymentSession(c.args.ctx, c.args.appleSess)
+			res, m, err := tClient.Wallets.ApplePaymentSession(c.args.ctx, c.args.appleSess)
 			if c.wantErr {
 				assert.NotNil(t, err)
 				assert.EqualError(t, err, c.err.Error())