@@ -101,6 +101,95 @@ func TestFixedSubscription_Create(t *testing.T) {
101101assert .Equal (t , 111614 , actual )
102102}
103103
104+ func TestFixedSubscription_Create_Marketplace (t * testing.T ) {
105+ server := httptest .NewServer (
106+ testServer (
107+ "apiKey" , "secret" ,
108+ postRequest (
109+ t ,
110+ "/fixed/subscriptions" ,
111+ `{
112+ "name": "My test fixed subscription with marketplace payments",
113+ "planId": 34811,
114+ "paymentMethod": "marketplace"
115+ }` ,
116+ `{
117+ "taskId": "2a6c6c5b-a16a-4f19-a803-17c1013a5888",
118+ "commandType": "fixedSubscriptionCreateRequest",
119+ "status": "received",
120+ "description": "Task request received and is being queued for processing.",
121+ "timestamp": "2024-05-09T09:36:16.122289471Z",
122+ "links": [
123+ {
124+ "rel": "task",
125+ "type": "GET",
126+ "href": "https://api-staging.qa.redislabs.com/v1/tasks/2a6c6c5b-a16a-4f19-a803-17c1013a5888"
127+ }
128+ ]
129+ }` ,
130+ ),
131+ getRequest (
132+ t ,
133+ "/tasks/2a6c6c5b-a16a-4f19-a803-17c1013a5888" ,
134+ `{
135+ "taskId": "2a6c6c5b-a16a-4f19-a803-17c1013a5888",
136+ "commandType": "fixedSubscriptionCreateRequest",
137+ "status": "initialized",
138+ "timestamp": "2020-10-28T09:58:16.798Z",
139+ "response": {},
140+ "_links": {
141+ "self": {
142+ "href": "https://example.com",
143+ "type": "GET"
144+ }
145+ }
146+ }` ,
147+ ),
148+ getRequest (
149+ t ,
150+ "/tasks/2a6c6c5b-a16a-4f19-a803-17c1013a5888" ,
151+ `{
152+ "taskId": "2a6c6c5b-a16a-4f19-a803-17c1013a5888",
153+ "commandType": "fixedSubscriptionCreateRequest",
154+ "status": "processing-completed",
155+ "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.",
156+ "timestamp": "2024-05-09T09:36:35.177603409Z",
157+ "response": {
158+ "resourceId": 111191
159+ },
160+ "links": [
161+ {
162+ "rel": "resource",
163+ "type": "GET",
164+ "href": "https://api-staging.qa.redislabs.com/v1/fixed/subscriptions/111191"
165+ },
166+ {
167+ "rel": "self",
168+ "type": "GET",
169+ "href": "https://api-staging.qa.redislabs.com/v1/tasks/2a6c6c5b-a16a-4f19-a803-17c1013a5888"
170+ }
171+ ]
172+ }` ,
173+ ),
174+ ),
175+ )
176+
177+ subject , err := clientFromTestServer (server , "apiKey" , "secret" )
178+ require .NoError (t , err )
179+
180+ actual , err := subject .FixedSubscriptions .Create (
181+ context .TODO (),
182+ fixedSubscriptions.FixedSubscription {
183+ Name : redis .String ("My test fixed subscription with marketplace payments" ),
184+ PlanId : redis .Int (34811 ),
185+ PaymentMethod : redis .String ("marketplace" ),
186+ },
187+ )
188+
189+ require .NoError (t , err )
190+ assert .Equal (t , 111191 , actual )
191+ }
192+
104193func TestFixedSubscription_List (t * testing.T ) {
105194server := httptest .NewServer (
106195testServer (
0 commit comments