Passed
Push — main ( 816aa1...fec294 )
by Acho
01:22
created

stubs.CheckoutGetResponse   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package stubs
2
3
// CheckoutGetResponse is a dummy response to the GET /v1/checkouts/:id endpoint
4
func CheckoutGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195"
12
  },
13
  "data": {
14
    "type": "checkouts",
15
    "id": "5e8b546c-c561-4a2c-a586-40c18bb2a195",
16
    "attributes": {
17
      "store_id": 1,
18
      "variant_id": 1,
19
      "custom_price": 50000,
20
      "product_options": {
21
        "name": "",
22
        "description": "",
23
        "media": [],
24
        "redirect_url": "",
25
        "receipt_button_text": "",
26
        "receipt_link_url": "",
27
        "receipt_thank_you_note": "",
28
        "enabled_variants": [
29
          1
30
        ]
31
      },
32
      "checkout_options": {
33
        "embed": false,
34
        "media": true,
35
        "logo": true,
36
        "desc": true,
37
        "discount": true,
38
        "dark": false,
39
        "subscription_preview": true,
40
        "button_color": "#2DD272"
41
      },
42
      "checkout_data": {
43
        "email": "",
44
        "name": "",
45
        "billing_address": null,
46
        "tax_number": "",
47
        "discount_code": "",
48
        "custom": null
49
      },
50
      "preview": {
51
        "currency": "USD",
52
        "currency_rate": 1,
53
        "subtotal": 5000,
54
        "discount_total": 0,
55
        "tax": 0,
56
        "total": 5000,
57
        "subtotal_usd": 5000,
58
        "discount_total_usd": 0,
59
        "tax_usd": 0,
60
        "total_usd": 5000,
61
        "subtotal_formatted": "$50.00",
62
        "discount_total_formatted": "$50.00",
63
        "tax_formatted": "$0.00",
64
        "total_formatted": "$5.00"
65
      },
66
      "expires_at": "2022-10-30T15:20:06.000000Z",
67
      "created_at": "2022-10-14T13:03:37.000000Z",
68
      "updated_at": "2022-10-14T13:03:37.000000Z",
69
      "test_mode": false,
70
      "url": "https://my-store.lemonsqueezy.com/checkout/custom/5e8b546c-c561-4a2c-a586-40c18bb2a195?expires=1667143206&signature=8f7248ad2022ef1d4111752ae02d14f8d04332274861ca5c3589eb22b5086a5b"
71
    },
72
    "relationships": {
73
      "store": {
74
        "links": {
75
          "related": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/store",
76
          "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/relationships/store"
77
        }
78
      },
79
      "variant": {
80
        "links": {
81
          "related": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/variant",
82
          "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/relationships/variant"
83
        }
84
      }
85
    },
86
    "links": {
87
      "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195"
88
    }
89
  }
90
}
91
`)
92
}
93
94
// CheckoutListResponse is a dummy response to GET /v1/checkouts
95
func CheckoutListResponse() []byte {
96
	return []byte(`
97
{
98
  "meta": {
99
    "page": {
100
      "currentPage": 1,
101
      "from": 1,
102
      "lastPage": 1,
103
      "perPage": 10,
104
      "to": 10,
105
      "total": 10
106
    }
107
  },
108
  "jsonapi": {
109
    "version": "1.0"
110
  },
111
  "links": {
112
    "first": "https://api.lemonsqueezy.com/v1/checkouts?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt",
113
    "last": "https://api.lemonsqueezy.com/v1/checkouts?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt"
114
  },
115
  "data": [
116
    {
117
      "type": "checkouts",
118
      "id": "ac470bd4-7c41-474d-b6cd-0f296f5be02a",
119
      "attributes": {
120
        "store_id": 1,
121
        "variant_id": 1,
122
        "custom_price": null,
123
        "product_options": {
124
          "name": "",
125
          "description": "",
126
          "media": [],
127
          "redirect_url": "",
128
          "receipt_button_text": "",
129
          "receipt_link_url": "",
130
          "receipt_thank_you_note": "",
131
          "enabled_variants": []
132
        },
133
        "checkout_options": {
134
          "embed": false,
135
          "media": true,
136
          "logo": true,
137
          "desc": true,
138
          "discount": true,
139
          "dark": false,
140
          "subscription_preview": true,
141
          "button_color": "#7047EB"
142
        },
143
        "checkout_data": {
144
          "email": "",
145
          "name": "",
146
          "billing_address": null,
147
          "tax_number": "",
148
          "discount_code": "",
149
          "custom": null
150
        },
151
        "expires_at": null,
152
        "created_at": "2022-10-14T12:36:27.000000Z",
153
        "updated_at": "2022-10-14T12:36:27.000000Z",
154
        "test_mode": false,
155
        "url": "https://my-store.lemonsqueezy.com/checkout/custom/ac470bd4-7c41-474d-b6cd-0f296f5be02a?signature=ee3fd20c5bac48fe5e976cb106e743bc3f6f330540f8003ab331d638e2ce3b8b"
156
      },
157
      "relationships": {
158
        "store": {
159
          "links": {
160
            "related": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/store",
161
            "self": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/relationships/store"
162
          }
163
        },
164
        "variant": {
165
          "links": {
166
            "related": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/variant",
167
            "self": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/relationships/variant"
168
          }
169
        }
170
      },
171
      "links": {
172
        "self": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a"
173
      }
174
    }
175
  ]
176
}
177
`)
178
}
179