Feature: Manage Billing As a admin user I want to be able to manage my billing information So that my account can stay up to date and in good standing Background: Given a paid plan exists with a name of "Paid" And the following account exists: | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year | street_address | extended_address | locality | region | postal_code | country_name | | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 | 1 Robo Lane | Suite 333 | Beverly Hills | CA | 90210 | United States of America | Scenario: Update the billing information on an account with a paid plan Given I have signed in with "joe@example.com" And "joe@example.com" is an admin of the "Test" account When I go to the billing page for the "Test" account Then I should see "card ending in 5555" And I should see "There have been no invoices yet." And I follow "Change" within ".current_credit_card" Then the "Cardholder name" field should contain "Joe Smith" And the "Billing email" field should contain "jsmith@example.com" And the "Card number" field should have nothing in it And the "Verification code" field should have nothing in it And the "Expiration month" field should contain "01" And the "Expiration year" field should contain "2015" And the "Address Line 1" field should contain "1 Robo Lane" And the "Address Line 2" field should contain "Suite 333" And the "City" field should contain "Beverly Hills" And the "State or Province" field should contain "CA" And the "ZIP or Postal Code" field should contain "90210" And the "Country" field should contain "United States of America" When I fill in "Cardholder name" with "Ralph Robot" And I fill in "Billing email" with "accounting@example.com" And I fill in "Card number" with "4111111111111111" And I fill in "Verification code" with "123" And I select "March" from "Expiration month" And I select "2020" from "Expiration year" And I fill in "Address Line 1" with "41 Winter St" And I fill in "Address Line 2" with "Floor 7" And I fill in "City" with "Boston" And I fill in "State or Province" with "MA" And I fill in "ZIP or Postal Code" with "02108" And I select "Uganda" from "Country" And I press "Update" Then I should see "updated successfully" And I should see "card ending in 1111" When I follow "Change" Then the "Address Line 1" field should contain "41 Winter St" And the "Address Line 2" field should contain "Floor 7" And the "City" field should contain "Boston" And the "State or Province" field should contain "MA" And the "ZIP or Postal Code" field should contain "02108" And the "Country" field should contain "Uganda" Scenario: Be forced to update the billing information on an account with a paid plan that is past due Given the "Test" account is past due And I have signed in with "joe@example.com" And "joe@example.com" is an admin of the "Test" account When I go to the settings page for the "Test" account Then I should be on the billing page for the "Test" account And I should see "There was an issue processing the credit card you have on file. Please update your credit card information." Scenario: Be told to have an admin update the billing information on an account with a paid plan that is past due Given the "Test" account is past due And the following projects exist: | name | account | | Project | name: Test | | Project2 | name: Test | And the following user exists: | email | | jsmith@example.com | And "jsmith@example.com" is a member of the "Project" project And I sign in as "jsmith@example.com" When I go to the accounts page Then I should see "There was an issue processing the credit card on file for this account. Please have an administrator on the account update the credit card information." Then I should be on the billing page for the "Test" account Scenario: View past credit card charges Given the following transaction exist for the "Test" account: | status | amount | created_at | | Settled | 20.00 | July 1, 2010 | | Settled | 5.00 | August 1, 2010 | And I have signed in with "joe@example.com" And "joe@example.com" is an admin of the "Test" account When I go to the billing page for the "Test" account Then I should see "Your Invoices" And I should see "07/01/10 $20" And I should see "08/01/10 $5" Scenario: Navigate back to the main settings page Given I have signed in with "joe@example.com" And "joe@example.com" is an admin of the "Test" account When I go to the billing page for the "Test" account And I follow "Change" And I follow "Billing" And I follow "Account Info" Then I should be on the settings page for the "Test" account Scenario: Billing countries Given I have signed in with "joe@example.com" And "joe@example.com" is an admin of the "Test" account When I go to the billing page for the "Test" account And I follow "Change" Then I should see all the Braintree countries in the country select with the following at the top: | United States of America | | Canada |