Sha256: 7366eef94470a209baca6af0ef8f7c201194d2dbf1aba192607120dcb3d8b2a9

Contents?: true

Size: 1.98 KB

Versions: 2

Compression:

Stored size: 1.98 KB

Contents

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:   2020,
            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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-forter-1.3.1 test/integration/workarea/storefront/checkouts_integration_test.decorator
workarea-forter-1.3.0 test/integration/workarea/storefront/checkouts_integration_test.decorator