Completed
Push — main ( d66aeb...e43a38 )
by Acho
25s queued 13s
created

internal/stubs/licenses.go   A

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
dl 0
loc 77
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A stubs.LicenseDeactivateResponse 0 2 1
A stubs.LicenseValidateResponse 0 2 1
A stubs.LicenseActivateResponse 0 2 1
1
package stubs
2
3
// LicenseActivateResponse is a dummy response to the POST /v1/licenses/activate endpoint
4
func LicenseActivateResponse() []byte {
5
	return []byte(`
6
	{
7
		"activated": true,
8
		"error": null,
9
		"license_key": {
10
			"id": 1,
11
			"status": "active",
12
			"key": "38b1460a-5104-4067-a91d-77b872934d51",
13
			"activation_limit": 1,
14
			"activation_usage": 5,
15
			"created_at": "2021-01-24T14:15:07.000000Z",
16
			"expires_at": null
17
		},
18
		"instance": {
19
			"id": "47596ad9-a811-4ebf-ac8a-03fc7b6d2a17",
20
			"name": "Test",
21
			"created_at": "2021-04-06T14:15:07.000000Z"
22
		},
23
		"meta": {
24
			"store_id": 1,
25
			"order_id": 2,
26
			"order_item_id": 3,
27
			"product_id": 4,
28
			"product_name": "Example Product",
29
			"variant_id": 5,
30
			"variant_name": "Default",
31
			"customer_id": 6,
32
			"customer_name": "Luke Skywalker",
33
			"customer_email": "[email protected]"
34
		}
35
	}
36
`)
37
}
38
39
// LicenseValidateResponse is a dummy response to the POST /v1/licenses/validate endpoint
40
func LicenseValidateResponse() []byte {
41
	return []byte(`
42
	{
43
		"valid": true,
44
		"error": null,
45
		"license_key": {
46
			"id": 1,
47
			"status": "active",
48
			"key": "38b1460a-5104-4067-a91d-77b872934d51",
49
			"activation_limit": 1,
50
			"activation_usage": 5,
51
			"created_at": "2021-01-24T14:15:07.000000Z",
52
			"expires_at": "2022-01-24T14:15:07.000000Z"
53
		},
54
		"instance": {
55
			"id": "f90ec370-fd83-46a5-8bbd-44a241e78665",
56
			"name": "Test",
57
			"created_at": "2021-02-24T14:15:07.000000Z"
58
		},
59
		"meta": {
60
			"store_id": 1,
61
			"order_id": 2,
62
			"order_item_id": 3,
63
			"product_id": 4,
64
			"product_name": "Example Product",
65
			"variant_id": 5,
66
			"variant_name": "Default",
67
			"customer_id": 6,
68
			"customer_name": "Luke Skywalker",
69
			"customer_email": "[email protected]"
70
		}
71
	}
72
`)
73
}
74
75
// LicenseDeactivateResponse is a dummy response to the POST /v1/licenses/deactivate endpoint
76
func LicenseDeactivateResponse() []byte {
77
	return []byte(`
78
	{
79
		"deactivated": true,
80
		"error": null,
81
		"license_key": {
82
			"id": 1,
83
			"status": "inactive",
84
			"key": "38b1460a-5104-4067-a91d-77b872934d51",
85
			"activation_limit": 5,
86
			"activation_usage": 0,
87
			"created_at": "2021-01-24T14:15:07.000000Z",
88
			"expires_at": null
89
		},
90
		"meta": {
91
			"store_id": 1,
92
			"order_id": 2,
93
			"order_item_id": 3,
94
			"product_id": 4,
95
			"product_name": "Example Product",
96
			"variant_id": 5,
97
			"variant_name": "Default",
98
			"customer_id": 6,
99
			"customer_name": "Luke Skywalker",
100
			"customer_email": "[email protected]"
101
		}
102
	}
103
`)
104
}
105