-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreceipt_confirm_test.go
56 lines (49 loc) · 1.02 KB
/
receipt_confirm_test.go
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
package smartbonus
import (
"testing"
uuid "github.com/satori/go.uuid"
)
func TestConfirmReceipt(t *testing.T) {
smartbonus := NewSmartBonus(testStoreId, "", testCustomerId)
// If client pay 900 change 2.36 you can accrued to smartbonus account
receipt := ReceiptConfirm{
UserId: testUserId,
Items: []NomenclatureItem{
{
Id: "2",
Quantity: 10,
Price: 89.65,
},
{
Id: "3",
Quantity: 0.245,
Price: 23.9,
},
},
Id: uuid.NewV4().String(),
Change: 2.36,
}
if _, err := smartbonus.ConfirmReceipt(receipt); err != nil {
t.Error(err.Error())
}
receipt = ReceiptConfirm{
UserId: testUserId,
Items: []NomenclatureItem{
{
Id: "2",
Quantity: 10,
Price: 89.65,
},
{
Id: "3",
Quantity: 0.245,
Price: 23.9,
},
},
Id: uuid.NewV4().String(),
Discount: 24, // amount of discount received from DiscountReceipt method.
}
if _, err := smartbonus.ConfirmReceipt(receipt); err != nil {
t.Error(err.Error())
}
}