Sha256: 6fa5db1448caf03605528bdb0190d03837c4faaaecfc5518e8d0d2ebbb9913d2

Contents?: true

Size: 1.99 KB

Versions: 1

Compression:

Stored size: 1.99 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:   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

Version data entries

1 entries across 1 versions & 1 rubygems

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