Passed
Push — main ( 5e41d5...6599d2 )
by Acho
01:26
created

internal/stubs/subscription_invoice.go   A

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
dl 0
loc 71
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stubs.SubscriptionInvoiceGetResponse 0 2 1
A stubs.SubscriptionInvoicesListResponse 0 2 1
1
package stubs
2
3
// SubscriptionInvoiceGetResponse is a dummy response to the GET /v1/subscription-invoice/:id endpoint
4
func SubscriptionInvoiceGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1"
12
  },
13
  "data": {
14
    "type": "subscription-invoices",
15
    "id": "1",
16
    "attributes": {
17
      "store_id": 1,
18
      "subscription_id": 1,
19
      "billing_reason": "initial",
20
      "card_brand": "visa",
21
      "card_last_four": "4242",
22
      "currency": "USD",
23
      "currency_rate": "1.00000000",
24
      "subtotal": 999,
25
      "discount_total": 0,
26
      "tax": 0,
27
      "total": 999,
28
      "subtotal_usd": 999,
29
      "discount_total_usd": 0,
30
      "tax_usd": 0,
31
      "total_usd": 999,
32
      "status": "paid",
33
      "status_formatted": "Paid",
34
      "refunded": 0,
35
      "refunded_at": null,
36
      "subtotal_formatted": "$9.99",
37
      "discount_total_formatted": "$0.00",
38
      "tax_formatted": "$0.00",
39
      "total_formatted": "$9.99",
40
      "urls": {
41
        "invoice_url": "https://app.lemonsqueezy.com/my-orders/.../subscription-invoice/..."
42
      },
43
      "created_at": "2023-01-18T12:16:24.000000Z",
44
      "updated_at": "2023-01-18T12:16:24.000000Z",
45
      "test_mode": false
46
    },
47
    "relationships": {
48
      "store": {
49
        "links": {
50
          "related": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/store",
51
          "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/relationships/store"
52
        }
53
      },
54
      "subscription": {
55
        "links": {
56
          "related": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/subscription",
57
          "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/relationships/subscription"
58
        }
59
      }
60
    },
61
    "links": {
62
      "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1"
63
    }
64
  }
65
}
66
`)
67
}
68
69
// SubscriptionInvoicesListResponse is a dummy response to GET /v1/subscription-invoice
70
func SubscriptionInvoicesListResponse() []byte {
71
	return []byte(`
72
{
73
  "meta": {
74
    "page": {
75
      "currentPage": 1,
76
      "from": 1,
77
      "lastPage": 1,
78
      "perPage": 10,
79
      "to": 10,
80
      "total": 10
81
    }
82
  },
83
  "jsonapi": {
84
    "version": "1.0"
85
  },
86
  "links": {
87
    "first": "https://api.lemonsqueezy.com/v1/subscription-invoices?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt",
88
    "last": "https://api.lemonsqueezy.com/v1/subscription-invoices?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt"
89
  },
90
  "data": [
91
    {
92
      "type": "subscription-invoices",
93
      "id": "1",
94
      "attributes": {
95
        "store_id": 1,
96
        "subscription_id": 1,
97
        "billing_reason": "initial",
98
        "card_brand": "visa",
99
        "card_last_four": "4242",
100
        "currency": "USD",
101
        "currency_rate": "1.00000000",
102
        "subtotal": 999,
103
        "discount_total": 0,
104
        "tax": 0,
105
        "total": 999,
106
        "subtotal_usd": 999,
107
        "discount_total_usd": 0,
108
        "tax_usd": 0,
109
        "total_usd": 999,
110
        "status": "paid",
111
        "status_formatted": "Paid",
112
        "refunded": 0,
113
        "refunded_at": null,
114
        "subtotal_formatted": "$9.99",
115
        "discount_total_formatted": "$0.00",
116
        "tax_formatted": "$0.00",
117
        "total_formatted": "$9.99",
118
        "urls": {
119
          "invoice_url": "https://app.lemonsqueezy.com/my-orders/.../subscription-invoice/..."
120
        },
121
        "created_at": "2023-01-18T12:16:24.000000Z",
122
        "updated_at": "2023-01-18T12:16:24.000000Z",
123
        "test_mode": false
124
      },
125
      "relationships": {
126
        "store": {
127
          "links": {
128
            "related": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/store",
129
            "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/relationships/store"
130
          }
131
        },
132
        "subscription": {
133
          "links": {
134
            "related": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/subscription",
135
            "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1/relationships/subscription"
136
          }
137
        }
138
      },
139
      "links": {
140
        "self": "https://api.lemonsqueezy.com/v1/subscription-invoices/1"
141
      }
142
    }
143
  ]
144
}
145
`)
146
}
147