-
Notifications
You must be signed in to change notification settings - Fork 4
/
orderreturns.clj
201 lines (169 loc) · 6.12 KB
/
orderreturns.clj
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
(ns happygapi.content.orderreturns
"Content API for Shopping: orderreturns.
Manage your product listings and accounts for Google Shopping
See: https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn acknowledge$
"https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns/acknowledge
Required parameters: merchantId, returnId
Optional parameters: none
Body:
{:operationId string}
Acks an order return in your Merchant Center account."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:returnId :merchantId})]}
(util/get-response
(http/post
(util/get-url
"https://shoppingcontent.googleapis.com/content/v2.1/"
"{merchantId}/orderreturns/{returnId}/acknowledge"
#{:returnId :merchantId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn createorderreturn$
"https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns/createorderreturn
Required parameters: merchantId
Optional parameters: none
Body:
{:orderId string,
:operationId string,
:lineItems [{:lineItemId string,
:productId string,
:quantity integer}],
:returnMethodType string}
Create return in your Merchant Center account."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:merchantId})]}
(util/get-response
(http/post
(util/get-url
"https://shoppingcontent.googleapis.com/content/v2.1/"
"{merchantId}/orderreturns/createOrderReturn"
#{:merchantId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn get$
"https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns/get
Required parameters: merchantId, returnId
Optional parameters: none
Retrieves an order return from your Merchant Center account."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:returnId :merchantId})]}
(util/get-response
(http/get
(util/get-url
"https://shoppingcontent.googleapis.com/content/v2.1/"
"{merchantId}/orderreturns/{returnId}"
#{:returnId :merchantId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns/list
Required parameters: merchantId
Optional parameters: createdEndDate, shipmentTypes, shipmentTrackingNumbers, shipmentStatus, createdStartDate, googleOrderIds, pageToken, acknowledged, maxResults, orderBy, shipmentStates
Lists order returns in your Merchant Center account."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:merchantId})]}
(util/get-response
(http/get
(util/get-url
"https://shoppingcontent.googleapis.com/content/v2.1/"
"{merchantId}/orderreturns"
#{:merchantId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn process$
"https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns/process
Required parameters: merchantId, returnId
Optional parameters: none
Body:
{:operationId string,
:returnItems [{:returnItemId string,
:refund OrderreturnsRefundOperation,
:reject OrderreturnsRejectOperation}],
:fullChargeReturnShippingCost boolean,
:refundShippingFee {:returnRefundReason string,
:fullRefund boolean,
:partialRefund OrderreturnsPartialRefund,
:reasonText string,
:paymentType string}}
Processes return in your Merchant Center account."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:returnId :merchantId})]}
(util/get-response
(http/post
(util/get-url
"https://shoppingcontent.googleapis.com/content/v2.1/"
"{merchantId}/orderreturns/{returnId}/process"
#{:returnId :merchantId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn labels-create$
"https://developers.google.com/shopping-content/v2/api/reference/rest/v2.1/orderreturns/labels/create
Required parameters: merchantId, returnId
Optional parameters: none
Body:
{:labelUri string, :carrier string, :trackingId string}
Links a return shipping label to a return id. You can only create one return label per return id. Since the label is sent to the buyer, the linked return label cannot be updated or deleted. If you try to create multiple return shipping labels for a single return id, every create request except the first will fail."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:returnId :merchantId})]}
(util/get-response
(http/post
(util/get-url
"https://shoppingcontent.googleapis.com/content/v2.1/"
"{merchantId}/orderreturns/{returnId}/labels"
#{:returnId :merchantId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))