Skip to content

Commit bd94f49

Browse files
committed
Add API for fetching the payment history for a user
1 parent 61b5eb6 commit bd94f49

File tree

13 files changed

+1106
-273
lines changed

13 files changed

+1106
-273
lines changed

api/docs/docs.go

Lines changed: 280 additions & 81 deletions
Large diffs are not rendered by default.

api/docs/swagger.json

Lines changed: 258 additions & 75 deletions
Large diffs are not rendered by default.

api/docs/swagger.yaml

Lines changed: 202 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ definitions:
102102
type: object
103103
entities.Message:
104104
properties:
105-
can_be_polled:
106-
example: false
107-
type: boolean
108105
contact:
109106
example: "+18005550100"
110107
type: string
@@ -192,28 +189,16 @@ definitions:
192189
example: WB7DRDWrJZRGbYrv2CKGkqbzvqdC
193190
type: string
194191
required:
195-
- can_be_polled
196192
- contact
197193
- content
198194
- created_at
199-
- delivered_at
200195
- encrypted
201-
- expired_at
202-
- failed_at
203-
- failure_reason
204196
- id
205-
- last_attempted_at
206197
- max_send_attempts
207198
- order_timestamp
208199
- owner
209-
- received_at
210-
- request_id
211200
- request_received_at
212-
- scheduled_at
213-
- scheduled_send_time
214201
- send_attempt_count
215-
- send_time
216-
- sent_at
217202
- sim
218203
- status
219204
- type
@@ -314,12 +299,10 @@ definitions:
314299
type: string
315300
required:
316301
- created_at
317-
- fcm_token
318302
- id
319303
- max_send_attempts
320304
- message_expiration_seconds
321305
- messages_per_minute
322-
- missed_call_auto_reply
323306
- phone_number
324307
- sim
325308
- updated_at
@@ -405,9 +388,6 @@ definitions:
405388
subscription_ends_at:
406389
example: "2022-06-05T14:26:02.302718+03:00"
407390
type: string
408-
subscription_id:
409-
example: 8f9c71b8-b84e-4417-8408-a62274f65a08
410-
type: string
411391
subscription_name:
412392
example: free
413393
type: string
@@ -424,7 +404,6 @@ definitions:
424404
example: "2022-06-05T14:26:10.303278+03:00"
425405
type: string
426406
required:
427-
- active_phone_id
428407
- api_key
429408
- created_at
430409
- email
@@ -433,11 +412,7 @@ definitions:
433412
- notification_message_status_enabled
434413
- notification_newsletter_enabled
435414
- notification_webhook_enabled
436-
- subscription_ends_at
437-
- subscription_id
438415
- subscription_name
439-
- subscription_renews_at
440-
- subscription_status
441416
- timezone
442417
- updated_at
443418
type: object
@@ -659,8 +634,9 @@ definitions:
659634
description:
660635
SendAt is an optional parameter used to schedule a message to
661636
be sent in the future. The time is considered to be in your profile's local
662-
timezone.
663-
example: "2022-06-05T14:26:09.527976+03:00"
637+
timezone and you can queue messages for up to 20 days (480 hours) in the
638+
future.
639+
example: "2025-12-19T16:39:57-08:00"
664640
type: string
665641
to:
666642
example: "+18005550100"
@@ -1135,6 +1111,21 @@ definitions:
11351111
- message
11361112
- status
11371113
type: object
1114+
responses.UserInvoicesResponse:
1115+
properties:
1116+
data:
1117+
$ref: "#/definitions/responses.subscriptionInvoicesAPIResponse"
1118+
message:
1119+
example: Request handled successfully
1120+
type: string
1121+
status:
1122+
example: success
1123+
type: string
1124+
required:
1125+
- data
1126+
- message
1127+
- status
1128+
type: object
11381129
responses.UserResponse:
11391130
properties:
11401131
data:
@@ -1182,6 +1173,114 @@ definitions:
11821173
- message
11831174
- status
11841175
type: object
1176+
responses.subscriptionInvoicesAPIResponse:
1177+
properties:
1178+
data:
1179+
items:
1180+
properties:
1181+
attributes:
1182+
properties:
1183+
billing_reason:
1184+
type: string
1185+
card_brand:
1186+
type: string
1187+
card_last_four:
1188+
type: string
1189+
created_at:
1190+
type: string
1191+
currency:
1192+
type: string
1193+
currency_rate:
1194+
type: string
1195+
discount_total:
1196+
type: integer
1197+
discount_total_formatted:
1198+
type: string
1199+
discount_total_usd:
1200+
type: integer
1201+
refunded:
1202+
type: boolean
1203+
refunded_amount:
1204+
type: integer
1205+
refunded_amount_formatted:
1206+
type: string
1207+
refunded_amount_usd:
1208+
type: integer
1209+
refunded_at: {}
1210+
status:
1211+
type: string
1212+
status_formatted:
1213+
type: string
1214+
subtotal:
1215+
type: integer
1216+
subtotal_formatted:
1217+
type: string
1218+
subtotal_usd:
1219+
type: integer
1220+
tax:
1221+
type: integer
1222+
tax_formatted:
1223+
type: string
1224+
tax_inclusive:
1225+
type: boolean
1226+
tax_usd:
1227+
type: integer
1228+
total:
1229+
type: integer
1230+
total_formatted:
1231+
type: string
1232+
total_usd:
1233+
type: integer
1234+
updated_at:
1235+
type: string
1236+
user_email:
1237+
type: string
1238+
user_name:
1239+
type: string
1240+
required:
1241+
- billing_reason
1242+
- card_brand
1243+
- card_last_four
1244+
- created_at
1245+
- currency
1246+
- currency_rate
1247+
- discount_total
1248+
- discount_total_formatted
1249+
- discount_total_usd
1250+
- refunded
1251+
- refunded_amount
1252+
- refunded_amount_formatted
1253+
- refunded_amount_usd
1254+
- refunded_at
1255+
- status
1256+
- status_formatted
1257+
- subtotal
1258+
- subtotal_formatted
1259+
- subtotal_usd
1260+
- tax
1261+
- tax_formatted
1262+
- tax_inclusive
1263+
- tax_usd
1264+
- total
1265+
- total_formatted
1266+
- total_usd
1267+
- updated_at
1268+
- user_email
1269+
- user_name
1270+
type: object
1271+
id:
1272+
type: string
1273+
type:
1274+
type: string
1275+
required:
1276+
- attributes
1277+
- id
1278+
- type
1279+
type: object
1280+
type: array
1281+
required:
1282+
- data
1283+
type: object
11851284
host: api.httpsms.com
11861285
info:
11871286
contact:
@@ -1282,9 +1381,11 @@ paths:
12821381
post:
12831382
consumes:
12841383
- multipart/form-data
1285-
description: Sends bulk SMS messages to multiple users from a CSV or Excel file.
1384+
description:
1385+
Sends bulk SMS messages to multiple users based on our [CSV template](https://httpsms.com/templates/httpsms-bulk.csv)
1386+
or our [Excel template](https://httpsms.com/templates/httpsms-bulk.xlsx).
12861387
parameters:
1287-
- description: The Excel or CSV file formatted according to the templates
1388+
- description: The Excel or CSV file containing the messages to be sent.
12881389
in: formData
12891390
name: document
12901391
required: true
@@ -1650,37 +1751,6 @@ paths:
16501751
summary: Sends a 3CX SMS message
16511752
tags:
16521753
- 3CXIntegration
1653-
/lemonsqueezy/event:
1654-
post:
1655-
consumes:
1656-
- application/json
1657-
description: Publish a lemonsqueezy event to the registered listeners
1658-
produces:
1659-
- application/json
1660-
responses:
1661-
"204":
1662-
description: No Content
1663-
schema:
1664-
$ref: "#/definitions/responses.NoContent"
1665-
"400":
1666-
description: Bad Request
1667-
schema:
1668-
$ref: "#/definitions/responses.BadRequest"
1669-
"401":
1670-
description: Unauthorized
1671-
schema:
1672-
$ref: "#/definitions/responses.Unauthorized"
1673-
"422":
1674-
description: Unprocessable Entity
1675-
schema:
1676-
$ref: "#/definitions/responses.UnprocessableEntity"
1677-
"500":
1678-
description: Internal Server Error
1679-
schema:
1680-
$ref: "#/definitions/responses.InternalServerError"
1681-
summary: Consume a lemonsqueezy event
1682-
tags:
1683-
- Lemonsqueezy
16841754
/message-threads:
16851755
get:
16861756
consumes:
@@ -2220,9 +2290,9 @@ paths:
22202290
post:
22212291
consumes:
22222292
- application/json
2223-
description: Add a new SMS message to be sent by the android phone
2293+
description: Add a new SMS message to be sent by your Android phone
22242294
parameters:
2225-
- description: PostSend message request payload
2295+
- description: Send message request payload
22262296
in: body
22272297
name: payload
22282298
required: true
@@ -2253,7 +2323,7 @@ paths:
22532323
$ref: "#/definitions/responses.InternalServerError"
22542324
security:
22552325
- ApiKeyAuth: []
2256-
summary: Send a new SMS message
2326+
summary: Send an SMS message
22572327
tags:
22582328
- Messages
22592329
/phone-api-keys:
@@ -2866,6 +2936,75 @@ paths:
28662936
summary: Currently authenticated user subscription update URL
28672937
tags:
28682938
- Users
2939+
/users/subscription/invoices:
2940+
get:
2941+
consumes:
2942+
- application/json
2943+
description:
2944+
Subscription invoices are generated throughout the lifecycle of
2945+
a subscription, typically there is one at the time of purchase and then one
2946+
for each renewal.
2947+
produces:
2948+
- application/json
2949+
responses:
2950+
"200":
2951+
description: OK
2952+
schema:
2953+
$ref: "#/definitions/responses.UserInvoicesResponse"
2954+
"400":
2955+
description: Bad Request
2956+
schema:
2957+
$ref: "#/definitions/responses.BadRequest"
2958+
"401":
2959+
description: Unauthorized
2960+
schema:
2961+
$ref: "#/definitions/responses.Unauthorized"
2962+
"422":
2963+
description: Unprocessable Entity
2964+
schema:
2965+
$ref: "#/definitions/responses.UnprocessableEntity"
2966+
"500":
2967+
description: Internal Server Error
2968+
schema:
2969+
$ref: "#/definitions/responses.InternalServerError"
2970+
security:
2971+
- ApiKeyAuth: []
2972+
summary: Get the last 10 subscription invoices.
2973+
tags:
2974+
- Users
2975+
/users/subscription/invoices/{subscriptionInvoiceID}:
2976+
post:
2977+
consumes:
2978+
- application/json
2979+
description: Generates a new invoice for the given subscription with given parameters.
2980+
produces:
2981+
- application/pdf
2982+
responses:
2983+
"200":
2984+
description: OK
2985+
schema:
2986+
type: file
2987+
"400":
2988+
description: Bad Request
2989+
schema:
2990+
$ref: "#/definitions/responses.BadRequest"
2991+
"401":
2992+
description: Unauthorized
2993+
schema:
2994+
$ref: "#/definitions/responses.Unauthorized"
2995+
"422":
2996+
description: Unprocessable Entity
2997+
schema:
2998+
$ref: "#/definitions/responses.UnprocessableEntity"
2999+
"500":
3000+
description: Internal Server Error
3001+
schema:
3002+
$ref: "#/definitions/responses.InternalServerError"
3003+
security:
3004+
- ApiKeyAuth: []
3005+
summary: Generate a subscription invoice
3006+
tags:
3007+
- Users
28693008
/webhooks:
28703009
get:
28713010
consumes:

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.54.0
1111
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.30.0
1212
github.com/NdoleStudio/go-otelroundtripper v0.0.13
13-
github.com/NdoleStudio/lemonsqueezy-go v1.2.4
13+
github.com/NdoleStudio/lemonsqueezy-go v1.3.1
1414
github.com/NdoleStudio/plunk-go v0.0.2
1515
github.com/avast/retry-go v3.0.0+incompatible
1616
github.com/carlmjohnson/requests v0.25.1

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZC
5656
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
5757
github.com/NdoleStudio/go-otelroundtripper v0.0.13 h1:fDgdxcNJov4LTrMhXqJnF/E3jO4HJVczj90wkxh5PSc=
5858
github.com/NdoleStudio/go-otelroundtripper v0.0.13/go.mod h1:UIUQ22ErFoBUyLuPDrVNRRKmBHBTfzQO9GF1ztqDvqo=
59-
github.com/NdoleStudio/lemonsqueezy-go v1.2.4 h1:BhWlCUH+DIPfSn4g/V7f2nFkMCQuzno9DXKZ7YDrXXA=
60-
github.com/NdoleStudio/lemonsqueezy-go v1.2.4/go.mod h1:2uZlWgn9sbNxOx3JQWLlPrDOC6NT/wmSTOgL3U/fMMw=
59+
github.com/NdoleStudio/lemonsqueezy-go v1.3.1 h1:lMUVgdAx2onbOUJIVPR05xAANYuCMXBRaGWpAdA4LiM=
60+
github.com/NdoleStudio/lemonsqueezy-go v1.3.1/go.mod h1:xKRsRX1jSI6mLrVXyWh2sF/1isxTioZrSjWy6HpA3xQ=
6161
github.com/NdoleStudio/plunk-go v0.0.2 h1:afPW7MHK4Z3rsybpJBnmTmxKCLKF1M7sPI+BNGPf35A=
6262
github.com/NdoleStudio/plunk-go v0.0.2/go.mod h1:pqG3zKhpn/A2bL1K+WsWzvfTpOeSkYgXhNk5H65uEc8=
6363
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=

0 commit comments

Comments
 (0)