module Workarea decorate Storefront::CheckoutsIntegrationTest, with: :forter do def test_saving_fraud_decision complete_checkout order = Order.desc(:created_at).first assert(order.fraud_decision.present?) assert(order.placed?) refute(order.fraud_suspected_at.present?) assert(order.fraud_decided_at.present?) assert_equal(:approve, order.fraud_decision.decision) post storefront.cart_items_path, params: { product_id: product.id, sku: product.skus.first, quantity: 1 } get storefront.checkout_addresses_path patch storefront.checkout_addresses_path, params: { email: 'decline@workarea.com', 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' } } get storefront.checkout_shipping_path patch storefront.checkout_shipping_path get storefront.checkout_payment_path patch storefront.checkout_place_order_path, params: { payment: 'new_card', credit_card: { number: '1', month: 1, year: next_year, cvv: '999' } } order = Order.desc(:created_at).first assert_equal(:declined, order.fraud_decision.decision) assert(order.fraud_suspected_at.present?) assert(order.fraud_decided_at.present?) refute(order.placed?) end end end