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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/workarea/storefront/integration_test.rb', line 13
def complete_checkout(email = nil, password = nil)
if Shipping::Service.blank?
create_shipping_service(
name: 'Ground',
tax_code: '001',
rates: [{ price: 7.to_m }]
)
end
post storefront.cart_items_path,
headers: ,
params: {
product_id: product.id,
sku: product.skus.first,
quantity: 2
}
if email.present? && password.present?
post storefront.login_path,
headers: ,
params: { email: email, password: password }
end
patch storefront.checkout_addresses_path,
headers: ,
params: {
email: '[email protected]',
billing_address: {
first_name: 'Ben',
last_name: 'Crouse',
street: '12 N. 3rd St.',
city: 'Philadelphia',
region: 'PA',
postal_code: '19106',
country: 'US',
phone_number: '2159251800'
},
shipping_address: {
first_name: 'Ben',
last_name: 'Crouse',
street: '22 S. 3rd St.',
city: 'Philadelphia',
region: 'PA',
postal_code: '19106',
country: 'US',
phone_number: '2159251800'
}
}
patch storefront.checkout_place_order_path,
headers: ,
params: {
payment: 'new_card',
credit_card: {
number: '1',
month: 1,
year: next_year,
cvv: '999'
}
}
end
|