mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Compare commits
27 Commits
dependabot
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59547ba9e4 | ||
|
|
9fb8bb15e8 | ||
|
|
8aa89c0bf7 | ||
|
|
7a4beb8b22 | ||
|
|
9a48ee16cc | ||
|
|
50c0e8af7d | ||
|
|
1cf2928f9f | ||
|
|
6cacde837d | ||
|
|
1d2d661675 | ||
|
|
5029c03205 | ||
|
|
2b648f3f3c | ||
|
|
4873fd3275 | ||
|
|
e0ad4363a9 | ||
|
|
7010cda9f7 | ||
|
|
70b2a6d999 | ||
|
|
28dde86960 | ||
|
|
9488e9b459 | ||
|
|
503429960a | ||
|
|
fd178ee80b | ||
|
|
e4db20f86e | ||
|
|
58520a0c4c | ||
|
|
0bc4b1c885 | ||
|
|
560348722c | ||
|
|
6d17cf50fb | ||
|
|
7b715bf6c7 | ||
|
|
2cfd386ad7 | ||
|
|
ce94b394b2 |
9
.github/ISSUE_TEMPLATE/release.md
vendored
9
.github/ISSUE_TEMPLATE/release.md
vendored
@@ -27,7 +27,12 @@ assignees: ''
|
||||
- [ ] Move this issue to Test Ready.
|
||||
- [ ] Notify `@testers` in [#testing].
|
||||
- [ ] Test build: [Deploy to Staging] with release tag.
|
||||
- [ ] Notify a deployer to deploy it
|
||||
- [ ] Map is displayed correctly. Address changes are reflected in the map.
|
||||
- [ ] Stripe with no authentication card: `4242424242424242` as shopper and as Admin. Order confirmation displays order as "Paid".
|
||||
- [ ] Stripe with Authentication required card: `4000002760003184` as shopper and as Admin. As admin, check authorization through customer account `/account#/transactions` and email.
|
||||
- [ ] Pay with Paypal.
|
||||
- [ ] Order on mobile.
|
||||
- [ ] Notify a deployer to deploy it.
|
||||
|
||||
## 3. Deployment at beginning of week
|
||||
|
||||
@@ -57,4 +62,4 @@ The full process is described at https://github.com/openfoodfoundation/openfoodn
|
||||
[Create issue]: https://github.com/openfoodfoundation/openfoodnetwork/issues/new?assignees=&labels=&projects=&template=release.md&title=Release
|
||||
[#delivery-circle]: https://openfoodnetwork.slack.com/archives/C01T75H6G0Z
|
||||
[Transifex Client]: https://developers.transifex.com/docs/cli
|
||||
[minor or major breaking changes]: https://github.com/openfoodfoundation/openfoodnetwork/pulls?q=label%3A%22breaking+change%22%2C%22major+breaking+change%22
|
||||
[minor or major breaking changes]: https://github.com/openfoodfoundation/openfoodnetwork/pulls?q=label%3A%22breaking+change%22%2C%22major+breaking+change%22
|
||||
|
||||
13
Gemfile.lock
13
Gemfile.lock
@@ -170,7 +170,7 @@ GEM
|
||||
addressable (2.8.8)
|
||||
public_suffix (>= 2.0.2, < 8.0)
|
||||
aes_key_wrap (1.1.0)
|
||||
afm (0.2.2)
|
||||
afm (1.0.0)
|
||||
angular-rails-templates (1.4.0)
|
||||
railties (>= 5.0, < 8.2)
|
||||
sprockets (>= 3.0, < 5)
|
||||
@@ -507,8 +507,7 @@ GEM
|
||||
logger
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.6)
|
||||
minitest (6.0.2)
|
||||
drb (~> 2.0)
|
||||
minitest (6.0.1)
|
||||
prism (~> 1.5)
|
||||
monetize (1.13.0)
|
||||
money (~> 6.12)
|
||||
@@ -520,7 +519,7 @@ GEM
|
||||
mutex_m (0.3.0)
|
||||
net-http (0.9.1)
|
||||
uri (>= 0.11.1)
|
||||
net-imap (0.6.3)
|
||||
net-imap (0.5.12)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
@@ -585,7 +584,7 @@ GEM
|
||||
xml-simple
|
||||
paypal-sdk-merchant (1.117.2)
|
||||
paypal-sdk-core (~> 0.3.0)
|
||||
pdf-reader (2.15.0)
|
||||
pdf-reader (2.15.1)
|
||||
Ascii85 (>= 1.0, < 3.0, != 2.0.0)
|
||||
afm (>= 0.2.1, < 2)
|
||||
hashery (~> 2.0)
|
||||
@@ -925,8 +924,8 @@ GEM
|
||||
unicode-emoji (4.2.0)
|
||||
uniform_notifier (1.18.0)
|
||||
uri (1.1.1)
|
||||
valid_email2 (7.0.15)
|
||||
activemodel (>= 6.0)
|
||||
valid_email2 (5.2.3)
|
||||
activemodel (>= 3.2)
|
||||
mail (~> 2.5)
|
||||
validate_url (1.0.15)
|
||||
activemodel (>= 3.0.0)
|
||||
|
||||
@@ -139,7 +139,7 @@ module CheckoutHelper
|
||||
def stripe_card_options(cards)
|
||||
cards.map do |cc|
|
||||
[
|
||||
"#{cc.brand} #{cc.last_digits} #{I18n.t(:card_expiry_abbreviation)}:" \
|
||||
"#{cc.cc_type} #{cc.last_digits} #{I18n.t(:card_expiry_abbreviation)}:" \
|
||||
"#{cc.month.to_s.rjust(2, '0')}/#{cc.year}", cc.id
|
||||
]
|
||||
end
|
||||
|
||||
@@ -76,6 +76,7 @@ class ProxyOrder < ApplicationRecord
|
||||
|
||||
def cart?
|
||||
order&.state == 'complete' &&
|
||||
order_cycle.orders_close_at.present? &&
|
||||
order_cycle.orders_close_at > Time.zone.now
|
||||
end
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@ module Spree
|
||||
|
||||
scope :with_payment_profile, -> { where.not(gateway_customer_profile_id: nil) }
|
||||
|
||||
# needed for some of the ActiveMerchant gateways (eg. SagePay)
|
||||
alias_attribute :brand, :cc_type
|
||||
|
||||
def expiry=(expiry)
|
||||
self[:month], self[:year] = expiry.split(" / ")
|
||||
self[:year] = "20#{self[:year]}"
|
||||
|
||||
@@ -52,9 +52,9 @@ module Spree
|
||||
|
||||
def supports?(source)
|
||||
return true unless provider_class.respond_to? :supports?
|
||||
return false unless source.brand
|
||||
return false unless source.cc_type
|
||||
|
||||
provider_class.supports?(source.brand)
|
||||
provider_class.supports?(source.cc_type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -193,4 +193,25 @@ RSpec.describe CheckoutHelper do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#stripe_card_options" do
|
||||
let(:year) { Time.zone.now.year + 1 }
|
||||
let(:card) { create(:credit_card, cc_type: 'visa', last_digits: '1111', month: 1, year:) }
|
||||
let(:cards) { [card] }
|
||||
|
||||
it "formats credit cards for Stripe options" do
|
||||
options = helper.stripe_card_options(cards)
|
||||
|
||||
expect(options).to eq([
|
||||
["visa 1111 Exp:01/#{year}", card.id]
|
||||
])
|
||||
end
|
||||
|
||||
it "zero-pads the month" do
|
||||
card.update(month: 5)
|
||||
options = helper.stripe_card_options(cards)
|
||||
|
||||
expect(options.first.first).to match(%r{05/#{year}})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -206,6 +206,69 @@ RSpec.describe ProxyOrder do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#state" do
|
||||
subject(:proxy_order) { build(:proxy_order, subscription:, order:, order_cycle:) }
|
||||
|
||||
let(:order) { build(:order) }
|
||||
let(:subscription) { build(:subscription) }
|
||||
let(:order_cycle) { build(:simple_order_cycle) }
|
||||
|
||||
context "when the proxy order is canceled" do
|
||||
it "returns 'canceled'" do
|
||||
proxy_order.canceled_at = Time.zone.now
|
||||
expect(proxy_order.state).to eq('canceled')
|
||||
end
|
||||
end
|
||||
|
||||
context "when the order is not present" do
|
||||
let(:order) { nil }
|
||||
|
||||
it "returns 'pending'" do
|
||||
expect(proxy_order.state).to eq('pending')
|
||||
end
|
||||
|
||||
context "when the subscription is paused" do
|
||||
it "returns 'paused'" do
|
||||
subscription.paused_at = Time.zone.now
|
||||
expect(proxy_order.state).to eq('paused')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the order cycle is not yet open" do
|
||||
let(:order_cycle) { build(:order_cycle, orders_open_at: 2.days.from_now) }
|
||||
|
||||
it "returns 'pending'" do
|
||||
expect(proxy_order.state).to eq('pending')
|
||||
end
|
||||
end
|
||||
|
||||
context "when the order is complete" do
|
||||
let(:order) { build(:completed_order_with_totals) }
|
||||
|
||||
context "when the order cycle is already closed" do
|
||||
it "returns 'complete'" do
|
||||
order_cycle.orders_close_at = 2.days.ago
|
||||
expect(proxy_order.state).to eq('complete')
|
||||
end
|
||||
end
|
||||
|
||||
context "when the order cycle is still open" do
|
||||
it "returns 'cart'" do
|
||||
order_cycle.orders_close_at = 2.days.from_now
|
||||
expect(proxy_order.state).to eq('cart')
|
||||
end
|
||||
end
|
||||
|
||||
context "when the order cycle does not have a closing date" do
|
||||
it "returns 'complete'" do
|
||||
order_cycle.orders_close_at = nil
|
||||
expect(proxy_order.state).to eq('complete')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def expect_cancelled_now(subject)
|
||||
|
||||
@@ -79,12 +79,6 @@ module ProductsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def validate_tomselect_with_search!(page, field_name, search_selector)
|
||||
open_tomselect_to_validate!(page, field_name) do
|
||||
expect(page).to have_selector(search_selector)
|
||||
end
|
||||
end
|
||||
|
||||
def random_producer(product)
|
||||
Enterprise.is_primary_producer
|
||||
.where.not(id: product.supplier.id)
|
||||
|
||||
@@ -167,7 +167,10 @@ RSpec.describe 'As an enterprise user, I can manage my products' do
|
||||
before do
|
||||
create_list(:supplier_enterprise, 11, users: [user])
|
||||
create_list(:tax_category, 11)
|
||||
create_list(:taxon, 11)
|
||||
build_list(:taxon, 11).each_with_index do |taxon, i|
|
||||
taxon.name += " #{i}"
|
||||
taxon.save!
|
||||
end
|
||||
|
||||
visit admin_products_url
|
||||
end
|
||||
@@ -178,24 +181,8 @@ RSpec.describe 'As an enterprise user, I can manage my products' do
|
||||
tax_category_to_select = random_tax_category
|
||||
|
||||
within row_containing_name(variant_a1.display_name) do
|
||||
validate_tomselect_with_search!(
|
||||
page, "Producer",
|
||||
producer_search_selector
|
||||
)
|
||||
tomselect_search_and_select(producer_to_select, from: "Producer")
|
||||
|
||||
sleep(0.1)
|
||||
validate_tomselect_with_search!(
|
||||
page, "Category",
|
||||
categories_search_selector
|
||||
)
|
||||
tomselect_search_and_select(category_to_select, from: "Category")
|
||||
|
||||
sleep(0.1)
|
||||
validate_tomselect_with_search!(
|
||||
page, "Tax Category",
|
||||
tax_categories_search_selector
|
||||
)
|
||||
tomselect_search_and_select(tax_category_to_select, from: "Tax Category")
|
||||
end
|
||||
|
||||
|
||||
12
yarn.lock
12
yarn.lock
@@ -4005,9 +4005,9 @@ hasown@^2.0.2:
|
||||
function-bind "^1.1.2"
|
||||
|
||||
hotkeys-js@*:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/hotkeys-js/-/hotkeys-js-4.0.0.tgz#75336c0ac610ad384d286c61c519909dcd4bdf6b"
|
||||
integrity sha512-gIoeqMWYqPIItc4HaseVbtTRpEpBbeufZMUcoWtN62JZdDq3KadS1ijN6wpaDjTzRK7PjT3QOPUcx+yNT0rrZQ==
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/hotkeys-js/-/hotkeys-js-4.0.1.tgz#d30f61568df248e22be864b6b86d22540438d0f6"
|
||||
integrity sha512-zjh2YxGhTMbddFUxyMOc35Iq0v86N7JnsB62m4hm34fG/CVX1ard7Gp3AJN4PK9lSLFexK14zPMNVwSYgz3tRg==
|
||||
|
||||
hpack.js@^2.1.6:
|
||||
version "2.1.6"
|
||||
@@ -7064,9 +7064,9 @@ toidentifier@1.0.1, toidentifier@~1.0.1:
|
||||
integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==
|
||||
|
||||
tom-select@*:
|
||||
version "2.5.1"
|
||||
resolved "https://registry.yarnpkg.com/tom-select/-/tom-select-2.5.1.tgz#8c8d3f11e5c1780b5f26c9e90f4e650842ff9596"
|
||||
integrity sha512-63D5/Qf6bb6kLSgksEuas/60oawDcuUHrD90jZofeOpF6bkQFYriKrvtpJBQQ4xIA5dUGcjhBbk/yrlfOQsy3g==
|
||||
version "2.5.2"
|
||||
resolved "https://registry.yarnpkg.com/tom-select/-/tom-select-2.5.2.tgz#77dd4bc780b1ea72905337b24f04ce19dc6d2ca1"
|
||||
integrity sha512-VAlGj5MBWVLMJje2NwA3XSmxa7CUFpp1tdzFZ8wymCkcLeP0NwF4ARmSuUK4BWbmSN1fETlSazWkMIxEpP4GdQ==
|
||||
dependencies:
|
||||
"@orchidjs/sifter" "^1.1.0"
|
||||
"@orchidjs/unicode-variants" "^1.1.2"
|
||||
|
||||
Reference in New Issue
Block a user