mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-14 18:56:49 +00:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
259e139c47 | ||
|
|
4ca930bdad | ||
|
|
f0a052b65b | ||
|
|
07a72eccd4 | ||
|
|
27586d072d | ||
|
|
3bfa903912 | ||
|
|
0ba670b180 | ||
|
|
c4cfc1dc05 | ||
|
|
17957ed6c0 | ||
|
|
8b6a08457a | ||
|
|
9e2a3d6973 | ||
|
|
55b21310e4 | ||
|
|
1266a37ac5 | ||
|
|
54feb2f57d | ||
|
|
e9eb90507e | ||
|
|
ee44159c83 | ||
|
|
8861f5c6aa | ||
|
|
b089404891 | ||
|
|
2fa2a30c67 | ||
|
|
cabec7e73f | ||
|
|
87df44764f | ||
|
|
8f25568530 | ||
|
|
b1b422b90e | ||
|
|
85d99f3bf2 | ||
|
|
c6b3a615f1 | ||
|
|
242c1a2715 | ||
|
|
21d67a0723 | ||
|
|
59b3bfa161 | ||
|
|
41a5787830 | ||
|
|
010c1c799d | ||
|
|
2faea65f82 | ||
|
|
dd8f139c1b | ||
|
|
6d0d4b5096 | ||
|
|
b85f8d4b45 | ||
|
|
f9869d4360 | ||
|
|
1cad631bdb | ||
|
|
03d49c7987 | ||
|
|
c07215552e | ||
|
|
2b01c80c54 | ||
|
|
fa77204e14 | ||
|
|
af713385d8 | ||
|
|
c9972189d0 | ||
|
|
eb07a91acb | ||
|
|
66ba9ff73d | ||
|
|
dbd41e9d31 | ||
|
|
87327dcf57 |
44
.github/workflows/brakeman-analysis.yml
vendored
Normal file
44
.github/workflows/brakeman-analysis.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# This workflow integrates Brakeman with GitHub's Code Scanning feature
|
||||
# Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
|
||||
|
||||
name: Brakeman Scan
|
||||
|
||||
# This section configures the trigger for the workflow. Feel free to customize depending on your convention
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
brakeman-scan:
|
||||
name: Brakeman Scan
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Customize the ruby version depending on your needs
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '2.4'
|
||||
|
||||
- name: Setup Brakeman
|
||||
env:
|
||||
BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
|
||||
run: |
|
||||
gem install brakeman --version $BRAKEMAN_VERSION
|
||||
|
||||
# Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Scan
|
||||
continue-on-error: true
|
||||
run: |
|
||||
brakeman -f sarif -o output.sarif.json .
|
||||
|
||||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: output.sarif.json
|
||||
1
Gemfile
1
Gemfile
@@ -65,7 +65,6 @@ gem 'haml'
|
||||
gem 'redcarpet'
|
||||
gem 'sass'
|
||||
gem 'sass-rails'
|
||||
gem 'truncate_html', '0.9.2'
|
||||
gem 'unicorn'
|
||||
|
||||
gem 'actionpack-action_caching'
|
||||
|
||||
@@ -635,7 +635,6 @@ GEM
|
||||
thread_safe (0.3.6)
|
||||
tilt (1.4.1)
|
||||
timecop (0.9.2)
|
||||
truncate_html (0.9.2)
|
||||
tzinfo (0.3.57)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
@@ -778,7 +777,6 @@ DEPENDENCIES
|
||||
test-prof
|
||||
test-unit (~> 3.3)
|
||||
timecop
|
||||
truncate_html (= 0.9.2)
|
||||
uglifier (>= 1.0.3)
|
||||
unicorn
|
||||
unicorn-rails
|
||||
|
||||
@@ -33,7 +33,9 @@ We also have a [Super Admin Guide][super-admin-guide] to help with configuration
|
||||
|
||||
## Testing
|
||||
|
||||
We use [BrowserStack](https://www.browserstack.com/) as a manual testing tool. BrowserStack provides open source projects with unlimited and free of charge accounts. A big thanks to them!
|
||||
If you'd like to help out with testing, please introduce yourself on the #testing channel on [Slack][slack-invite] and download the [ZenHub browser extension][zenhub] to view the development pipeline.
|
||||
|
||||
We use [BrowserStack](https://www.browserstack.com/) as a manual testing tool. BrowserStack provides open source projects with unlimited and free of charge accounts. A big thanks to them!
|
||||
|
||||
## Licence
|
||||
|
||||
@@ -45,3 +47,4 @@ Copyright (c) 2012 - 2020 Open Food Foundation, released under the AGPL licence.
|
||||
[ofn-install]: https://github.com/openfoodfoundation/ofn-install
|
||||
[super-admin-guide]: https://ofn-user-guide.gitbook.io/ofn-super-admin-guide
|
||||
[welcome-dev]: https://github.com/openfoodfoundation/openfoodnetwork/projects/27
|
||||
[zenhub]: https://www.zenhub.com/extension
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'open_food_network/address_finder'
|
||||
class CheckoutController < Spree::StoreController
|
||||
layout 'darkswarm'
|
||||
|
||||
include OrderStockCheck
|
||||
include CheckoutHelper
|
||||
include OrderCyclesHelper
|
||||
include EnterprisesHelper
|
||||
@@ -24,7 +25,7 @@ class CheckoutController < Spree::StoreController
|
||||
|
||||
before_action :ensure_order_not_completed
|
||||
before_action :ensure_checkout_allowed
|
||||
before_action :ensure_sufficient_stock_lines
|
||||
before_action :handle_insufficient_stock
|
||||
|
||||
before_action :associate_user
|
||||
before_action :check_authorization
|
||||
@@ -77,13 +78,6 @@ class CheckoutController < Spree::StoreController
|
||||
redirect_to main_app.cart_path if @order.completed?
|
||||
end
|
||||
|
||||
def ensure_sufficient_stock_lines
|
||||
if @order.insufficient_stock_lines.present?
|
||||
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
|
||||
redirect_to main_app.cart_path
|
||||
end
|
||||
end
|
||||
|
||||
def load_order
|
||||
@order = current_order
|
||||
|
||||
|
||||
18
app/controllers/concerns/order_stock_check.rb
Normal file
18
app/controllers/concerns/order_stock_check.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module OrderStockCheck
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def handle_insufficient_stock
|
||||
return if sufficient_stock?
|
||||
|
||||
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
|
||||
redirect_to main_app.cart_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sufficient_stock?
|
||||
@sufficient_stock ||= @order.insufficient_stock_lines.blank?
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Spree::PaypalController.class_eval do
|
||||
include OrderStockCheck
|
||||
|
||||
before_action :enable_embedded_shopfront
|
||||
before_action :destroy_orphaned_paypal_payments, only: :confirm
|
||||
after_action :reset_order_when_complete, only: :confirm
|
||||
@@ -40,6 +42,9 @@ Spree::PaypalController.class_eval do
|
||||
begin
|
||||
pp_response = provider.set_express_checkout(pp_request)
|
||||
if pp_response.success?
|
||||
# At this point Paypal has *provisionally* accepted that the payment can now be placed,
|
||||
# and the user will be redirected to a Paypal payment page. On completion, the user is
|
||||
# sent back and the response is handled in the #confirm action in this controller.
|
||||
redirect_to provider.express_checkout_url(pp_response, useraction: 'commit')
|
||||
else
|
||||
flash[:error] = Spree.t('flash.generic_error', scope: 'paypal', reasons: pp_response.errors.map(&:long_message).join(" "))
|
||||
@@ -51,6 +56,32 @@ Spree::PaypalController.class_eval do
|
||||
end
|
||||
end
|
||||
|
||||
def confirm
|
||||
@order = current_order || raise(ActiveRecord::RecordNotFound)
|
||||
|
||||
# At this point the user has come back from the Paypal form, and we get one
|
||||
# last chance to interact with the payment process before the money moves...
|
||||
return reset_to_cart unless sufficient_stock?
|
||||
|
||||
@order.payments.create!({
|
||||
source: Spree::PaypalExpressCheckout.create({
|
||||
token: params[:token],
|
||||
payer_id: params[:PayerID]
|
||||
}),
|
||||
amount: @order.total,
|
||||
payment_method: payment_method
|
||||
})
|
||||
@order.next
|
||||
if @order.complete?
|
||||
flash.notice = Spree.t(:order_processed_successfully)
|
||||
flash[:commerce_tracking] = "nothing special"
|
||||
session[:order_id] = nil
|
||||
redirect_to completion_route(@order)
|
||||
else
|
||||
redirect_to checkout_state_path(@order.state)
|
||||
end
|
||||
end
|
||||
|
||||
def cancel
|
||||
flash[:notice] = Spree.t('flash.cancel', scope: 'paypal')
|
||||
redirect_to main_app.checkout_path
|
||||
@@ -66,6 +97,10 @@ Spree::PaypalController.class_eval do
|
||||
|
||||
private
|
||||
|
||||
def payment_method
|
||||
@payment_method ||= Spree::PaymentMethod.find(params[:payment_method_id])
|
||||
end
|
||||
|
||||
def permit_parameters!
|
||||
params.permit(:token, :payment_method_id, :PayerID)
|
||||
end
|
||||
@@ -79,6 +114,11 @@ Spree::PaypalController.class_eval do
|
||||
end
|
||||
end
|
||||
|
||||
def reset_to_cart
|
||||
OrderCheckoutRestart.new(@order).call
|
||||
handle_insufficient_stock
|
||||
end
|
||||
|
||||
# See #1074 and #1837 for more detail on why we need this
|
||||
# An 'orphaned' Spree::Payment is created for every call to CheckoutController#update
|
||||
# for orders that are processed using a Spree::Gateway::PayPalExpress payment method
|
||||
|
||||
@@ -3,11 +3,16 @@
|
||||
# Your secret key for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
Openfoodnetwork::Application.config.secret_token = if Rails.env.development? or Rails.env.test?
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
|
||||
secret_key = if Rails.env.development? or Rails.env.test?
|
||||
('x' * 30) # Meets basic minimum of 30 chars.
|
||||
else
|
||||
ENV["SECRET_TOKEN"]
|
||||
end
|
||||
|
||||
Openfoodnetwork::Application.config.secret_key_base = 'ceb1eb86c50285e696f899b2e7ea306d1ec1e81fe5c7af0e5cbc238bebe3fd60f19df7b9076fab836182821ebe14e41b64bdcdb4370520dc5bb711c1bc0ae616'
|
||||
# Rails 4+ key for signing and encrypting cookies.
|
||||
Openfoodnetwork::Application.config.secret_key_base = secret_key
|
||||
|
||||
# Legacy secret_token variable. This is still used directly for encryption.
|
||||
Openfoodnetwork::Application.config.secret_token = secret_key
|
||||
|
||||
@@ -3492,7 +3492,7 @@ ar:
|
||||
remember_this_card: تذكر هذه البطاقة؟
|
||||
date_picker:
|
||||
format: '٪ س-٪ م-%d'
|
||||
js_format: 'يوم-شهر-سنة'
|
||||
js_format: 'yy-mm-dd'
|
||||
orders:
|
||||
error_flash_for_unavailable_items: "عنصر في سلة التسوق الخاصة بك أصبح غير متوفر. يرجى تحديث الكميات المحددة."
|
||||
edit:
|
||||
|
||||
@@ -2888,6 +2888,8 @@ ca:
|
||||
delete: "Suprimir"
|
||||
cannot_set_shipping_method_without_address: "No es pot establir el mètode d'enviament fins que no es proporcionin les dades del client."
|
||||
no_tracking_present: "No es proporcionen dades de seguiment."
|
||||
tracking: "Seguiment"
|
||||
tracking_number: "Número de seguiment"
|
||||
order_total: "Total comanda"
|
||||
customer_details: "Detalls de la consumidora"
|
||||
customer_search: "Cerca la consumidora"
|
||||
|
||||
@@ -14,6 +14,7 @@ en_AU:
|
||||
spree/payment:
|
||||
amount: Amount
|
||||
state: State
|
||||
source: Source
|
||||
spree/product:
|
||||
primary_taxon: "Product Category"
|
||||
supplier: "Supplier"
|
||||
@@ -23,6 +24,9 @@ en_AU:
|
||||
spree/credit_card:
|
||||
base: "Credit Card"
|
||||
number: "Number"
|
||||
month: "Month"
|
||||
verification_value: "Verification Value"
|
||||
year: "Year"
|
||||
order_cycle:
|
||||
orders_close_at: Close date
|
||||
variant_override:
|
||||
@@ -35,6 +39,10 @@ en_AU:
|
||||
taken: "There's already an account for this email. Please login or reset your password."
|
||||
spree/order:
|
||||
no_card: There are no authorised credit cards available to charge
|
||||
spree/credit_card:
|
||||
attributes:
|
||||
base:
|
||||
card_expired: "has expired"
|
||||
order_cycle:
|
||||
attributes:
|
||||
orders_close_at:
|
||||
@@ -56,6 +64,8 @@ en_AU:
|
||||
shipping_method_ids: "Shipping Methods"
|
||||
payment_method_ids: "Payment Methods"
|
||||
errors:
|
||||
messages:
|
||||
inclusion: "is not included in the list"
|
||||
models:
|
||||
order_management/subscriptions/validator:
|
||||
attributes:
|
||||
@@ -115,6 +125,8 @@ en_AU:
|
||||
not_array_error: "must be an array"
|
||||
invalid_element_error: "must contain only valid integers"
|
||||
datetime_picker_ui:
|
||||
current_text: Now
|
||||
close_text: Done
|
||||
time_text: Time
|
||||
enterprise_mailer:
|
||||
confirmation_instructions:
|
||||
@@ -180,6 +192,7 @@ en_AU:
|
||||
explainer: Automatic processing of these orders failed for an unknown reason. This should not occur, please contact us if you are seeing this.
|
||||
home: "OFN"
|
||||
title: "Open Food Network"
|
||||
welcome_to: "Welcome to"
|
||||
site_meta_description: "We begin from the ground up. With farmers and growers ready to tell their stories proudly and truly. With distributors ready to connect people with products fairly and honestly. With buyers who believe that better weekly shopping decisions can…"
|
||||
search_by_name: Search by name or suburb...
|
||||
producers_join: Australian producers are now welcome to join the Open Food Network.
|
||||
@@ -222,6 +235,7 @@ en_AU:
|
||||
enterprises: Enterprises
|
||||
enterprise_groups: Groups
|
||||
reports: Reports
|
||||
listing_reports: Listing Reports
|
||||
variant_overrides: Inventory
|
||||
import: Import
|
||||
spree_products: Spree Products
|
||||
@@ -251,6 +265,8 @@ en_AU:
|
||||
notes: Notes
|
||||
error: Error
|
||||
processing_payment: "Processing payment..."
|
||||
no_pending_payments: "No pending payments"
|
||||
invalid_payment_state: "Invalid payment state"
|
||||
filter_results: Filter Results
|
||||
quantity: Quantity
|
||||
pick_up: Pick up
|
||||
@@ -266,15 +282,23 @@ en_AU:
|
||||
on hand: "On Hand"
|
||||
ship: "Ship"
|
||||
shipping_category: "Shipping Category"
|
||||
height: "Height"
|
||||
width: "Width"
|
||||
depth: "Depth"
|
||||
actions:
|
||||
create_and_add_another: "Create and Add Another"
|
||||
create: "Create"
|
||||
cancel: "Cancel"
|
||||
resume: "Resume"
|
||||
save: "Save"
|
||||
edit: "Edit"
|
||||
update: "Update"
|
||||
delete: "Delete"
|
||||
add: "Add"
|
||||
cut: "Cut"
|
||||
paste: "Paste"
|
||||
destroy: "Destroy"
|
||||
rename: "Rename"
|
||||
admin:
|
||||
begins_at: Begins At
|
||||
begins_on: Begins On
|
||||
@@ -322,6 +346,7 @@ en_AU:
|
||||
show_n_more: Show %{num} more
|
||||
choose: "Choose..."
|
||||
please_select: Please select...
|
||||
column_save_as_default: Save As Default
|
||||
columns: Columns
|
||||
actions: Actions
|
||||
viewing: "Viewing: %{current_view_name}"
|
||||
@@ -332,6 +357,7 @@ en_AU:
|
||||
has_n_rules: "has %{num} rules"
|
||||
unsaved_confirm_leave: "There are unsaved changed on this page. Continue without saving?"
|
||||
unsaved_changes: "You have unsaved changes"
|
||||
available_units: "Available Units"
|
||||
shopfront_settings:
|
||||
embedded_shopfront_settings: "Embedded Shopfront Settings"
|
||||
enable_embedded_shopfronts: "Enable Embedded Shopfronts"
|
||||
@@ -366,7 +392,10 @@ en_AU:
|
||||
title: "Matomo Settings"
|
||||
matomo_url: "Matomo URL"
|
||||
matomo_site_id: "Matomo Site ID"
|
||||
matomo_tag_manager_url: "Matomo Tag Manager URL"
|
||||
info_html: "Matomo is a Web and Mobile Analytics application. You can either host Matomo on-premises or use a cloud-hosted service. See <a href='http://matomo.org' target='_blank'>matomo.org</a> for more information."
|
||||
config_instructions_html: "Here you can configure the OFN Matomo integration. The Matomo URL below should point to the Matomo instance where the user tracking information will be sent to; if it is left empty, Matomo user tracking will be disabled. The Site ID field is not mandatory but useful if you are tracking more than one website on a single Matomo instance; it can be found on the Matomo instance console."
|
||||
config_instructions_tag_manager_html: "Setting the Matomo Tag Manager URL enables Matomo Tag Manager. This tool allows you to set up analytics events. The Matomo Tag Manager URL is copied from the Install Code section of Matomo Tag Manager. Ensure you select the right container and environment as these options change the URL."
|
||||
customers:
|
||||
index:
|
||||
new_customer: "New Customer"
|
||||
@@ -387,6 +416,8 @@ en_AU:
|
||||
confirm_delete: "Sure to delete?"
|
||||
search_by_email: "Search by email/code..."
|
||||
guest_label: "Guest checkout"
|
||||
credit_owed: "Credit Owed"
|
||||
balance_due: "Balance Due"
|
||||
destroy:
|
||||
has_associated_orders: "Delete failed: customer has associated orders with his shop"
|
||||
contents:
|
||||
@@ -473,6 +504,7 @@ en_AU:
|
||||
line_number: "Line %{number}:"
|
||||
encoding_error: "Please check the language setting of your source file and ensure it is saved with UTF-8 encoding"
|
||||
unexpected_error: "Product Import encountered an unexpected error whilst opening the file: %{error_message}"
|
||||
malformed_csv: "Product Import encountered a malformed CSV: %{error_message}"
|
||||
index:
|
||||
notice: "Notice"
|
||||
beta_notice: "This feature is still in beta: you may experience some errors while using it. Please don't hesitate to contact support."
|
||||
@@ -574,6 +606,8 @@ en_AU:
|
||||
controls:
|
||||
back_to_my_inventory: Back to my inventory
|
||||
orders:
|
||||
edit:
|
||||
order_sure_want_to: Are you sure you want to %{event} this order?
|
||||
invoice_email_sent: 'Invoice email has been sent'
|
||||
order_email_resent: 'Order email has been resent'
|
||||
bulk_management:
|
||||
@@ -583,6 +617,7 @@ en_AU:
|
||||
order_date: "Completed at"
|
||||
max: "Max"
|
||||
product_unit: "Product: Unit"
|
||||
weight_volume: "Weight/Volume (g)"
|
||||
ask: "Ask?"
|
||||
page_title: "Bulk Order Management"
|
||||
actions_delete: "Delete Selected"
|
||||
@@ -619,6 +654,9 @@ en_AU:
|
||||
acn_placeholder: eg. 123 456 789
|
||||
display_invoice_logo: Display logo in invoices
|
||||
invoice_text: Add customized text at the end of invoices
|
||||
terms_and_conditions: "Terms and Conditions"
|
||||
remove_terms_and_conditions: "Remove File"
|
||||
uploaded_on: "uploaded on"
|
||||
contact:
|
||||
name: Name
|
||||
name_placeholder: eg. Gustav Plum
|
||||
@@ -686,6 +724,7 @@ en_AU:
|
||||
ofn_uid_tip: The unique id used to identify the enterprise on Open Food Network.
|
||||
shipping_methods:
|
||||
name: "Name"
|
||||
applies: "Active?"
|
||||
manage: "Manage Shipping Methods"
|
||||
create_button: "Create New Shipping Method"
|
||||
create_one_button: "Create One Now"
|
||||
@@ -708,6 +747,8 @@ en_AU:
|
||||
enable_subscriptions_tip: "Enable subscriptions functionality?"
|
||||
enable_subscriptions_false: "Disabled"
|
||||
enable_subscriptions_true: "Enabled"
|
||||
customer_names_in_reports: "Customer Names in Reports"
|
||||
customer_names_tip: "Enable your suppliers to see your customers names in reports"
|
||||
customer_names_false: "Disabled"
|
||||
customer_names_true: "Enabled"
|
||||
shopfront_message: "\"Home\" message"
|
||||
@@ -727,6 +768,7 @@ en_AU:
|
||||
is displayed on your shop only when you have no active order cycles
|
||||
(ie. shop is closed).
|
||||
shopfront_category_ordering: "Shopfront Category Ordering"
|
||||
shopfront_category_ordering_note: "(top to bottom)"
|
||||
open_date: "Open Date"
|
||||
close_date: "Close Date"
|
||||
social:
|
||||
@@ -868,6 +910,7 @@ en_AU:
|
||||
incoming: "Incoming"
|
||||
supplier: "Supplier"
|
||||
products: "Products"
|
||||
receival_details: "Receival Details"
|
||||
fees: "Fees"
|
||||
save: "Save"
|
||||
save_and_next: "Save and Next"
|
||||
@@ -879,6 +922,7 @@ en_AU:
|
||||
distributor: "Distributor"
|
||||
products: "Products"
|
||||
tags: "Tags"
|
||||
delivery_details: "Delivery Details"
|
||||
fees: "Fees"
|
||||
previous: "Previous"
|
||||
save: "Save"
|
||||
@@ -1132,10 +1176,18 @@ en_AU:
|
||||
destroy_attachment_does_not_exist: "Logo does not exist"
|
||||
enterprise_promo_image:
|
||||
destroy_attachment_does_not_exist: "Promo image does not exist"
|
||||
enterprise_terms_and_conditions:
|
||||
destroy_attachment_does_not_exist: "Terms and Conditions file does not exist"
|
||||
orders:
|
||||
failed_to_update: "Failed to update order"
|
||||
checkout:
|
||||
already_ordered:
|
||||
cart: "cart"
|
||||
message_html: "You have an order for this order cycle already. Check the %{cart} to see the items you ordered before. You can also cancel items as long as the order cycle is open."
|
||||
terms_and_conditions:
|
||||
message_html: "I agree to the seller's %{terms_and_conditions_link}."
|
||||
link_text: "Terms and Conditions"
|
||||
failed: "The checkout failed. Please let us know so that we can process your order."
|
||||
shops:
|
||||
hubs:
|
||||
show_closed_shops: "Show closed shops"
|
||||
@@ -1147,7 +1199,12 @@ en_AU:
|
||||
cart: "Cart"
|
||||
cart_sidebar:
|
||||
checkout: "Checkout"
|
||||
edit_cart: "Edit cart"
|
||||
items_in_cart_singular: "%{num} item in your cart"
|
||||
items_in_cart_plural: "%{num} items in your cart"
|
||||
close: "Close"
|
||||
cart_empty: "Your cart is empty"
|
||||
take_me_shopping: "Take me shopping!"
|
||||
signed_in:
|
||||
profile: "Profile"
|
||||
mobile_menu:
|
||||
@@ -1179,7 +1236,11 @@ en_AU:
|
||||
signup: "signup"
|
||||
contact: "contact"
|
||||
require_customer_login: "Only approved customers can access this shop."
|
||||
require_login_html: "If you're already an approved customer, %{login} or %{signup} to proceed."
|
||||
require_login_2_html: "Want to start shopping here? Please %{contact} %{enterprise} and ask about joining."
|
||||
require_customer_html: "If you'd like to start shopping here, please %{contact} %{enterprise} to ask about joining."
|
||||
select_oc:
|
||||
select_oc_html: "Please <span class='highlighted'>choose when you want your order</span>, to see what products are available."
|
||||
products:
|
||||
summary:
|
||||
bulk: "Bulk"
|
||||
@@ -1311,6 +1372,7 @@ en_AU:
|
||||
saving_credit_card: Saving credit card...
|
||||
card_has_been_removed: "Your card has been removed (number: %{number})"
|
||||
card_could_not_be_removed: Sorry, the card could not be removed
|
||||
invalid_credit_card: "Invalid credit card"
|
||||
ie_warning_headline: "Your browser is out of date :-("
|
||||
ie_warning_text: "For the best Open Food Network experience, we strongly recommend upgrading your browser:"
|
||||
ie_warning_chrome: Download Chrome
|
||||
@@ -1506,6 +1568,7 @@ en_AU:
|
||||
shopping_oc_closed_description: "Please wait until the next cycle opens (or contact us directly to see if we can accept any late orders)"
|
||||
shopping_oc_last_closed: "The last cycle closed %{distance_of_time} ago"
|
||||
shopping_oc_next_open: "The next cycle opens in %{distance_of_time}"
|
||||
shopping_oc_select: "Select..."
|
||||
shopping_tabs_home: "Home"
|
||||
shopping_tabs_shop: "Shop"
|
||||
shopping_tabs_about: "About"
|
||||
@@ -1537,18 +1600,24 @@ en_AU:
|
||||
hubs_distance: Closest to
|
||||
hubs_distance_filter: "Show me shops near %{location}"
|
||||
shop_changeable_orders_alert_html:
|
||||
one: Your order with <a href='%{path}' target='_blank'>%{shop} / %{order}</a> is open for review. You can make changes until %{oc_close}.
|
||||
few: You have <a href='%{path}' target='_blank'>%{count} orders with %{shop}</a> currently open for review. You can make changes until %{oc_close}.
|
||||
many: You have <a href='%{path}' target='_blank'>%{count} orders with %{shop}</a> currently open for review. You can make changes until %{oc_close}.
|
||||
other: You have <a href='%{path}' target='_blank'>%{count} orders with %{shop}</a> currently open for review. You can make changes until %{oc_close}.
|
||||
orders_changeable_orders_alert_html: This order has been confirmed, but you can make changes until <strong>%{oc_close}</strong>.
|
||||
products_clear: Clear
|
||||
products_showing: "Showing:"
|
||||
products_results_for: "Results for"
|
||||
products_or: "or"
|
||||
products_and: "and"
|
||||
products_filters_in: "in"
|
||||
products_with: with
|
||||
products_search: "Search..."
|
||||
products_filter_by: "Filter by"
|
||||
products_filter_selected: "selected"
|
||||
products_filter_heading: "Filters"
|
||||
products_filter_clear: "Clear"
|
||||
products_filter_done: "Done"
|
||||
products_loading: "Loading products..."
|
||||
products_updating_cart: "Updating cart..."
|
||||
products_cart_empty: "Cart empty"
|
||||
@@ -1559,6 +1628,8 @@ en_AU:
|
||||
products_update_error_msg: "Saving failed."
|
||||
products_update_error_data: "Save failed due to invalid data:"
|
||||
products_changes_saved: "Changes saved."
|
||||
products_no_results_html: "Sorry, no results found for %{query}"
|
||||
products_clear_search: "Clear search"
|
||||
search_no_results_html: "Sorry, no results found for %{query}. Try another search?"
|
||||
components_profiles_popover: "Profiles do not have a shopfront on the Open Food Network, but may have their own physical or online shop elsewhere"
|
||||
components_profiles_show: "Show profiles"
|
||||
@@ -1677,6 +1748,7 @@ en_AU:
|
||||
orders_could_not_cancel: "Sorry, the order could not be cancelled"
|
||||
orders_cannot_remove_the_final_item: "Cannot remove the final item from an order, please cancel the order instead."
|
||||
orders_bought_items_notice:
|
||||
one: An additional item is already confirmed for this order cycle
|
||||
few: "%{count} additional items already confirmed for this order cycle"
|
||||
many: "%{count} additional items already confirmed for this order cycle"
|
||||
other: "%{count} additional items already confirmed for this order cycle"
|
||||
@@ -1700,6 +1772,7 @@ en_AU:
|
||||
remember_me: Remember Me
|
||||
are_you_sure: "Are you sure?"
|
||||
orders_open: "Orders open"
|
||||
closing: "Closing"
|
||||
going_back_to_home_page: "Taking you back to the home page"
|
||||
creating: Creating
|
||||
updating: Updating
|
||||
@@ -1867,6 +1940,7 @@ en_AU:
|
||||
headline: "You’re all set up! "
|
||||
thanks: "Thanks for filling out the details for %{enterprise}."
|
||||
login: "To manage your new Enterprise, go to openfoodnetwork.org.au/admin\n\nYou can also get to your Admin page in the top righthand corner of the Open Food Network homepage, just to the left of the shopping cart symbol."
|
||||
action: "Go to Enterprise Dashboard"
|
||||
back: "Back"
|
||||
continue: "Continue"
|
||||
action_or: "OR"
|
||||
@@ -1912,6 +1986,7 @@ en_AU:
|
||||
admin_enterprise_relationships_permits: "permits"
|
||||
admin_enterprise_relationships_seach_placeholder: "Search"
|
||||
admin_enterprise_relationships_button_create: "Create"
|
||||
admin_enterprise_relationships_to: "to"
|
||||
admin_enterprise_groups: "Enterprise Groups"
|
||||
admin_enterprise_groups_name: "Name"
|
||||
admin_enterprise_groups_owner: "Owner"
|
||||
@@ -1940,6 +2015,7 @@ en_AU:
|
||||
supplier: "Supplier"
|
||||
product_name: "Product Name"
|
||||
product_description: "Product Description"
|
||||
permalink: "Permalink"
|
||||
shipping_categories: "Shipping Categories"
|
||||
units: "Unit Size"
|
||||
coordinator: "Coordinator"
|
||||
@@ -1952,6 +2028,8 @@ en_AU:
|
||||
tax_category: "Tax Category"
|
||||
calculator: "Calculator"
|
||||
calculator_values: "Calculator values"
|
||||
calculator_settings_warning: "If you are changing the calculator type, you must save first before you can edit the calculator settings"
|
||||
calculator_preferred_unit_error: "must be kg or lb"
|
||||
flat_percent_per_item: "Flat Percent (per item)"
|
||||
flat_rate_per_item: "Flat Rate (per item)"
|
||||
flat_rate_per_order: "Flat Rate (per order)"
|
||||
@@ -2035,6 +2113,7 @@ en_AU:
|
||||
remove_tax: "Remove tax"
|
||||
first_name_begins_with: "First name begins with"
|
||||
last_name_begins_with: "Last name begins with"
|
||||
shipping_method: "Shipping method"
|
||||
new_order: "New Order"
|
||||
enterprise_tos_link: "Enterprise Terms of Service link"
|
||||
enterprise_tos_message: "We want to work with people that share our aims and values. As such we ask new enterprises to agree to our "
|
||||
@@ -2054,6 +2133,7 @@ en_AU:
|
||||
hub_sidebar_at_least: "At least one hub must be selected"
|
||||
hub_sidebar_blue: "blue"
|
||||
hub_sidebar_red: "red"
|
||||
order_cycles_closed_for_hub: "The hub you have selected is temporarily closed for orders. Please try again later."
|
||||
report_customers_distributor: "Distributor"
|
||||
report_customers_supplier: "Supplier"
|
||||
report_customers_cycle: "Order Cycle"
|
||||
@@ -2259,6 +2339,7 @@ en_AU:
|
||||
enterprise_name_error: "has already been taken. If this is your enterprise and you would like to claim ownership, or if you would like to trade with this enterprise please contact the current manager of this profile at %{email}."
|
||||
enterprise_owner_error: "^%{email} is not permitted to own any more enterprises (limit is %{enterprise_limit})."
|
||||
enterprise_role_uniqueness_error: "^That role is already present."
|
||||
enterprise_terms_and_conditions_type_error: "Only PDFs are allowed"
|
||||
inventory_item_visibility_error: must be true or false
|
||||
product_importer_file_error: "error: no file uploaded"
|
||||
product_importer_spreadsheet_error: "could not process file: invalid filetype"
|
||||
@@ -2282,6 +2363,7 @@ en_AU:
|
||||
enterprise_register_success_notice: "Congratulations! Registration for %{enterprise} is complete!"
|
||||
enterprise_bulk_update_success_notice: "Enterprises updated successfully"
|
||||
enterprise_bulk_update_error: 'Update failed'
|
||||
enterprise_shop_show_error: "The shop you are looking for doesn't exist or is inactive on OFN. Please check other shops."
|
||||
order_cycles_create_notice: 'Your order cycle has been created.'
|
||||
order_cycles_update_notice: 'Your order cycle has been updated.'
|
||||
order_cycles_bulk_update_notice: 'Order cycles have been updated.'
|
||||
@@ -2289,6 +2371,7 @@ en_AU:
|
||||
order_cycles_email_to_producers_notice: 'Emails to be sent to producers have been queued for sending.'
|
||||
order_cycles_no_permission_to_coordinate_error: "None of your enterprises have permission to coordinate an order cycle"
|
||||
order_cycles_no_permission_to_create_error: "You don't have permission to create an order cycle coordinated by that enterprise"
|
||||
order_cycle_closed: "The order cycle you've selected has just closed. Please try again!"
|
||||
back_to_orders_list: "Back to order list"
|
||||
no_orders_found: "No Orders Found"
|
||||
order_information: "Order Information"
|
||||
@@ -2316,6 +2399,10 @@ en_AU:
|
||||
resolve_errors: Please resolve the following errors
|
||||
more_items: "+ %{count} More"
|
||||
default_card_updated: Default Card Updated
|
||||
cart:
|
||||
add_to_cart_failed: >
|
||||
There was a problem adding this product to the cart. Perhaps it has become
|
||||
unavailable or the shop is closing.
|
||||
admin:
|
||||
enterprise_limit_reached: "You have reached the standard limit of enterprises per account. Write to %{contact_email} if you need to increase it."
|
||||
modals:
|
||||
@@ -2341,6 +2428,14 @@ en_AU:
|
||||
By creating rules related to a specific customer tag, you can override
|
||||
the default behaviour (whether it be to show or to hide items) for customers
|
||||
with the specified tag.
|
||||
terms_and_conditions_info:
|
||||
title: "Uploading Terms and Conditions"
|
||||
message_1: "Terms and Conditions are the contract between you, the seller, and the shopper. If you upload a file here shoppers must accept your Terms and Conditions in order to complete checkout. For the shopper this will appear as a checkbox at checkout that must be checked in order to proceed with checkout. We highly recommend you upload Terms and Conditions in alignment with national legislation."
|
||||
message_2: "Shoppers will only be required to accept Terms and Conditions once. However if you change you Terms and Conditions shoppers will again be required to accept them before they can checkout."
|
||||
terms_and_conditions_warning:
|
||||
title: "Uploading Terms and Conditions"
|
||||
message_1: "All your buyers will have to agree to them once at checkout. If you update the file, all your buyers will have to agree to them again at checkout."
|
||||
message_2: "For buyers with subscriptions, you need to email them the Terms and Conditions (or the changes to them) for now, nothing will notify them about these new Terms and Conditions."
|
||||
panels:
|
||||
save: SAVE
|
||||
saved: SAVED
|
||||
@@ -2434,6 +2529,12 @@ en_AU:
|
||||
severity: Severity
|
||||
description: Description
|
||||
resolve: Resolve
|
||||
exchange_products:
|
||||
load_more_variants: "Load More Variants"
|
||||
load_all_variants: "Load All Variants"
|
||||
select_all_variants: "Select All %{total_number_of_variants} Variants"
|
||||
variants_loaded: "%{num_of_variants_loaded} of %{total_number_of_variants} Variants Loaded"
|
||||
loading_variants: "Loading Variants"
|
||||
tag_rules:
|
||||
shipping_method_tagged_top: "Shipping methods tagged"
|
||||
shipping_method_tagged_bottom: "are:"
|
||||
@@ -2516,6 +2617,7 @@ en_AU:
|
||||
customer_placeholder: "customer@example.org"
|
||||
valid_email_error: "Please enter a valid email address"
|
||||
subscriptions:
|
||||
error_saving: "Error saving subscription"
|
||||
new:
|
||||
please_select_a_shop: "Please select a shop"
|
||||
enterprises:
|
||||
@@ -2525,6 +2627,8 @@ en_AU:
|
||||
immediate_logo_removal_warning: "The logo will be removed immediately after you confirm."
|
||||
removed_promo_image_successfully: "Promo image removed successfully"
|
||||
immediate_promo_image_removal_warning: "The promo image will be removed immediately after you confirm."
|
||||
immediate_terms_and_conditions_removal_warning: "The Terms and Conditions file will be removed immediately after you confirm."
|
||||
removed_terms_and_conditions_successfully: "Terms and Conditions file removed successfully"
|
||||
insufficient_stock: "Insufficient stock available, only %{on_hand} remaining"
|
||||
out_of_stock:
|
||||
reduced_stock_available: Reduced stock available
|
||||
@@ -2536,8 +2640,12 @@ en_AU:
|
||||
shopfront:
|
||||
variant:
|
||||
add_to_cart: "Add"
|
||||
in_cart: "in cart"
|
||||
quantity_in_cart: "%{quantity} in cart"
|
||||
bulk_buy_modal:
|
||||
min_quantity: "Min quantity"
|
||||
max_quantity: "Max quantity"
|
||||
price_breakdown: "Price breakdown"
|
||||
variants:
|
||||
on_demand:
|
||||
'yes': "On demand"
|
||||
@@ -2603,6 +2711,84 @@ en_AU:
|
||||
signup_or_login: "Start By Signing Up (or logging in)"
|
||||
have_an_account: "Already have an account?"
|
||||
action_login: "Log in now."
|
||||
stripe_elements:
|
||||
unknown_error_from_stripe: |
|
||||
There was a problem setting up your card in our payments gateway.
|
||||
Please refresh the page and try again, if it fails a second time,
|
||||
please contact us for support.
|
||||
inflections:
|
||||
each:
|
||||
one: "each"
|
||||
other: "each"
|
||||
bunch:
|
||||
one: "bunch"
|
||||
other: "bunches"
|
||||
pack:
|
||||
one: "pack"
|
||||
other: "packs"
|
||||
box:
|
||||
one: "box"
|
||||
other: "boxes"
|
||||
bottle:
|
||||
one: "bottle"
|
||||
other: "bottles"
|
||||
jar:
|
||||
one: "jar"
|
||||
other: "jars"
|
||||
head:
|
||||
one: "head"
|
||||
other: "heads"
|
||||
bag:
|
||||
one: "bag"
|
||||
other: "bags"
|
||||
loaf:
|
||||
one: "loaf"
|
||||
other: "loaves"
|
||||
single:
|
||||
one: "single"
|
||||
other: "singles"
|
||||
tub:
|
||||
one: "tub"
|
||||
other: "tubs"
|
||||
punnet:
|
||||
one: "punnet"
|
||||
other: "punnets"
|
||||
packet:
|
||||
one: "packet"
|
||||
other: "packets"
|
||||
item:
|
||||
one: "item"
|
||||
other: "items"
|
||||
dozen:
|
||||
one: "dozen"
|
||||
other: "dozens"
|
||||
unit:
|
||||
one: "unit"
|
||||
other: "units"
|
||||
serve:
|
||||
one: "serve"
|
||||
other: "serves"
|
||||
tray:
|
||||
one: "tray"
|
||||
other: "trays"
|
||||
piece:
|
||||
one: "piece"
|
||||
other: "pieces"
|
||||
pot:
|
||||
one: "pot"
|
||||
other: "pots"
|
||||
bundle:
|
||||
one: "bundle"
|
||||
other: "bundles"
|
||||
flask:
|
||||
one: "flask"
|
||||
other: "flasks"
|
||||
basket:
|
||||
one: "basket"
|
||||
other: "baskets"
|
||||
sack:
|
||||
one: "sack"
|
||||
other: "sacks"
|
||||
producers:
|
||||
signup:
|
||||
start_free_profile: "Start with a free profile, and expand when you're ready!"
|
||||
@@ -2660,6 +2846,8 @@ en_AU:
|
||||
adjustments: "Adjustments"
|
||||
payments: "Payments"
|
||||
return_authorizations: "Return Authorizations"
|
||||
credit_owed: "Credit Owed"
|
||||
new_adjustment: "New Adjustment"
|
||||
payment: "Payment"
|
||||
payment_method: "Payment Method"
|
||||
shipment: "Shipment"
|
||||
@@ -2706,6 +2894,8 @@ en_AU:
|
||||
delete: "Delete"
|
||||
cannot_set_shipping_method_without_address: "Cannot set shipping method until customer details are provided."
|
||||
no_tracking_present: "No tracking details provided."
|
||||
tracking: "Tracking"
|
||||
tracking_number: "Tracking Number"
|
||||
order_total: "Order Total"
|
||||
customer_details: "Customer Details"
|
||||
customer_search: "Customer Search"
|
||||
@@ -2733,6 +2923,14 @@ en_AU:
|
||||
void: "Void"
|
||||
login: "Login"
|
||||
password: "Password"
|
||||
signature: "Signature"
|
||||
solution: "Solution"
|
||||
landing_page: "Landing Page"
|
||||
server: "Server"
|
||||
test_mode: "Test Mode"
|
||||
logourl: "Logourl"
|
||||
are_you_sure_delete: "Are you sure you want to delete this record?"
|
||||
confirm_delete: "Confirm Deletion"
|
||||
configurations: "Configurations"
|
||||
general_settings: "General Settings"
|
||||
site_name: "Site Name"
|
||||
@@ -2834,16 +3032,31 @@ en_AU:
|
||||
inventory_error_flash_for_insufficient_quantity: "An item in your cart has become unavailable."
|
||||
inventory: Inventory
|
||||
zipcode: Postcode
|
||||
weight: Weight (per kg or lb)
|
||||
error_user_destroy_with_orders: "Users with completed orders may not be deleted"
|
||||
cannot_create_payment_without_payment_methods: "You cannot create a payment for an order without any payment methods defined."
|
||||
please_define_payment_methods: "Please define some payment methods first."
|
||||
options: "Options"
|
||||
has_no_shipped_units: "has no shipped units"
|
||||
successfully_created: '%{resource} has been successfully created!'
|
||||
successfully_updated: '%{resource} has been successfully updated!'
|
||||
payment_method: "Payment Method"
|
||||
payment_processing_failed: "Payment could not be processed, please check the details you entered"
|
||||
not_available: "N/A"
|
||||
order_populator:
|
||||
out_of_stock: '%{item} is out of stock.'
|
||||
actions:
|
||||
update: "Update"
|
||||
shared:
|
||||
error_messages:
|
||||
errors_prohibited_this_record_from_being_saved:
|
||||
one: "1 error prohibited this record from being saved:"
|
||||
few: "%{count} errors prohibited this record from being saved:"
|
||||
many: "%{count} errors prohibited this record from being saved:"
|
||||
other: "%{count} errors prohibited this record from being saved:"
|
||||
there_were_problems_with_the_following_fields: "There were problems with the following fields"
|
||||
payments_list:
|
||||
date_time: "Date/time"
|
||||
amount: "Amount"
|
||||
payment_method: "Payment Method"
|
||||
payment_state: "Payment State"
|
||||
@@ -2930,6 +3143,7 @@ en_AU:
|
||||
capture: "Capture"
|
||||
ship: "Ship"
|
||||
edit: "Edit"
|
||||
order_not_updated: "The order could not be updated"
|
||||
note: "Note"
|
||||
first: "First"
|
||||
last: "Last"
|
||||
@@ -2952,6 +3166,8 @@ en_AU:
|
||||
tax_invoice: "TAX INVOICE"
|
||||
code: "Code"
|
||||
from: "From"
|
||||
to: "Bill to"
|
||||
shipping: "Shipping"
|
||||
form:
|
||||
distribution_fields:
|
||||
title: "Distribution"
|
||||
@@ -2989,6 +3205,8 @@ en_AU:
|
||||
zone: "Zone"
|
||||
calculator: "Calculator"
|
||||
display: "Display"
|
||||
both: "Both Checkout and Back office"
|
||||
back_end: "Back office only"
|
||||
no_shipping_methods_found: "No shipping methods found"
|
||||
new:
|
||||
new_shipping_method: "New Shipping Method"
|
||||
@@ -3000,6 +3218,9 @@ en_AU:
|
||||
form:
|
||||
categories: "Categories"
|
||||
zones: "Zones"
|
||||
both: "Both Checkout and Back office"
|
||||
back_end: "Back office only"
|
||||
deactivation_warning: "De-activating a shipping method can make the shipping method disappear from your list. Alternatively, you can hide a shipping method from the checkout page by setting the option 'Display' to 'back office only'."
|
||||
payment_methods:
|
||||
index:
|
||||
payment_methods: "Payment Methods"
|
||||
@@ -3011,8 +3232,11 @@ en_AU:
|
||||
display: "Display"
|
||||
active: "Active"
|
||||
both: "Both"
|
||||
front_end: "Checkout only"
|
||||
back_end: "Back office only"
|
||||
active_yes: "Yes"
|
||||
active_no: "No"
|
||||
no_payment_methods_found: "No payment methods found"
|
||||
new:
|
||||
new_payment_method: "New Payment Method"
|
||||
back_to_payment_methods_list: "Back To Payment Methods List"
|
||||
@@ -3041,7 +3265,11 @@ en_AU:
|
||||
active: "Active"
|
||||
active_yes: "Yes"
|
||||
active_no: "No"
|
||||
both: "Both Checkout and Back office"
|
||||
front_end: "Checkout only"
|
||||
back_end: "Back office only"
|
||||
tags: "Tags"
|
||||
deactivation_warning: "De-activating a payment method can make the payment method disappear from your list. Alternatively, you can hide a payment method from the checkout page by setting the option 'Display' to 'back office only'."
|
||||
providers:
|
||||
provider: "Provider"
|
||||
payments:
|
||||
@@ -3049,6 +3277,8 @@ en_AU:
|
||||
stripe:
|
||||
error_saving_payment: Error saving payment
|
||||
submitting_payment: Submitting payment...
|
||||
paypal:
|
||||
no_payment_via_admin_backend: Paypal payments cannot be captured in the Backoffice
|
||||
products:
|
||||
image_upload_error: "The product image was not recognised. Please upload an image in PNG or JPG format."
|
||||
new:
|
||||
@@ -3102,6 +3332,8 @@ en_AU:
|
||||
bulk_coop_allocation: 'Bulk Co-op - Allocation'
|
||||
bulk_coop_packing_sheets: 'Bulk Co-op - Packing Sheets'
|
||||
bulk_coop_customer_payments: 'Bulk Co-op - Customer Payments'
|
||||
customer_names_message:
|
||||
customer_names_tip: "If customer names are hidden for orders you have supplied, you can contact the distributor and ask if they can update their shop preferences to allow their suppliers to view customer names."
|
||||
users:
|
||||
index:
|
||||
listing_users: "Listing Users"
|
||||
@@ -3143,6 +3375,8 @@ en_AU:
|
||||
price: "Price"
|
||||
display_as: "Display As"
|
||||
display_name: "Display Name"
|
||||
display_as_placeholder: 'eg. 2 kg'
|
||||
display_name_placeholder: 'eg. Tomatoes'
|
||||
autocomplete:
|
||||
out_of_stock: "Out of Stock"
|
||||
producer_name: "Producer"
|
||||
@@ -3182,6 +3416,7 @@ en_AU:
|
||||
format: '%Y-%m-%d'
|
||||
js_format: 'yy-mm-dd'
|
||||
orders:
|
||||
error_flash_for_unavailable_items: "An item in your cart has become unavailable. Please update the selected quantities."
|
||||
edit:
|
||||
login_to_view_order: "Please log in to view your order."
|
||||
bought:
|
||||
@@ -3209,6 +3444,14 @@ en_AU:
|
||||
invalid: invalid
|
||||
order_mailer:
|
||||
cancel_email:
|
||||
customer_greeting: "Dear %{name},"
|
||||
instructions_html: "Your order with <strong>%{distributor}</strong> has been CANCELED. Please retain this cancellation information for your records."
|
||||
dont_cancel: "If you have changed your mind or don't wish to cancel this order please contact %{email}"
|
||||
order_summary_canceled_html: "<strong>Order Summary #%{number} [CANCELED]</strong>"
|
||||
details: "Here are the details of what you ordered:"
|
||||
unpaid_order: "Your order was unpaid so no refund has been made"
|
||||
paid_order: "Your order was paid so %{distributor} has refunded the full amount"
|
||||
credit_order: "Your order was paid so your account has been credited"
|
||||
subject: "Cancellation of Order"
|
||||
confirm_email:
|
||||
subject: "Order Confirmation"
|
||||
@@ -3225,6 +3468,7 @@ en_AU:
|
||||
issue_text: |
|
||||
If the above URL does not work try copying and pasting it into your browser.
|
||||
If you continue to have problems please feel free to contact us.
|
||||
subject: "Reset password instructions"
|
||||
confirmation_instructions:
|
||||
subject: "Please confirm your OFN account"
|
||||
shipment_mailer:
|
||||
@@ -3236,6 +3480,11 @@ en_AU:
|
||||
thanks: "Thank you for your business."
|
||||
track_information: "Tracking Information: %{tracking}"
|
||||
track_link: "Tracking Link: %{url}"
|
||||
test_mailer:
|
||||
test_email:
|
||||
greeting: "Congratulations!"
|
||||
message: "If you have received this email, then your email settings are correct."
|
||||
subject: "Test Mail"
|
||||
order_state:
|
||||
address: address
|
||||
adjustments: adjustments
|
||||
@@ -3318,3 +3567,8 @@ en_AU:
|
||||
shipment:
|
||||
cannot_ready: "Cannot ready shipment."
|
||||
invalid_taxonomy_id: "Invalid taxonomy id."
|
||||
activerecord:
|
||||
models:
|
||||
spree/payment:
|
||||
one: Payment
|
||||
other: Payments
|
||||
|
||||
@@ -289,11 +289,16 @@ en_NZ:
|
||||
create_and_add_another: "Create and Add Another"
|
||||
create: "Create"
|
||||
cancel: "Cancel"
|
||||
resume: "Resume"
|
||||
save: "Save"
|
||||
edit: "Edit"
|
||||
update: "Update"
|
||||
delete: "Delete"
|
||||
add: "Add"
|
||||
cut: "Cut"
|
||||
paste: "Paste"
|
||||
destroy: "Destroy"
|
||||
rename: "Rename"
|
||||
admin:
|
||||
begins_at: Begins At
|
||||
begins_on: Begins On
|
||||
@@ -601,6 +606,8 @@ en_NZ:
|
||||
controls:
|
||||
back_to_my_inventory: Back to my inventory
|
||||
orders:
|
||||
edit:
|
||||
order_sure_want_to: Are you sure you want to %{event} this order?
|
||||
invoice_email_sent: 'Invoice email has been sent'
|
||||
order_email_resent: 'Order email has been resent'
|
||||
bulk_management:
|
||||
@@ -2877,6 +2884,8 @@ en_NZ:
|
||||
delete: "Delete"
|
||||
cannot_set_shipping_method_without_address: "Cannot set shipping method until customer details are provided."
|
||||
no_tracking_present: "No tracking details provided."
|
||||
tracking: "Tracking"
|
||||
tracking_number: "Tracking Number"
|
||||
order_total: "Order Total"
|
||||
customer_details: "Customer Details"
|
||||
customer_search: "Customer Search"
|
||||
@@ -2910,6 +2919,8 @@ en_NZ:
|
||||
server: "Server"
|
||||
test_mode: "Test Mode"
|
||||
logourl: "Logourl"
|
||||
are_you_sure_delete: "Are you sure you want to delete this record?"
|
||||
confirm_delete: "Confirm Deletion"
|
||||
configurations: "Configurations"
|
||||
general_settings: "General Settings"
|
||||
site_name: "Site Name"
|
||||
|
||||
@@ -2888,6 +2888,8 @@ es:
|
||||
delete: "Borrar"
|
||||
cannot_set_shipping_method_without_address: "No se puede establecer el método de envío hasta que se proporcionen los detalles de la consumidora."
|
||||
no_tracking_present: "No se han proporcionado detalles de seguimiento."
|
||||
tracking: "Seguimiento"
|
||||
tracking_number: "Número de seguimiento"
|
||||
order_total: "Total del pedido"
|
||||
customer_details: "Detalles de la consumidora"
|
||||
customer_search: "Búsqueda de consumidores"
|
||||
|
||||
@@ -829,17 +829,17 @@ pt_BR:
|
||||
owner: Proprietário
|
||||
producer: Produtor
|
||||
change_type_form:
|
||||
producer_profile: Perfil do produtor
|
||||
producer_profile: Perfil Simples
|
||||
connect_ofn: Conecte-se através da OFB
|
||||
always_free: SEMPRE GRATUITO
|
||||
producer_description_text: Adicione os seus produtos à Open Food Brasil, permitindo que as centrais os comercialize em suas lojas.
|
||||
producer_shop: Loja do produtor
|
||||
producer_shop: Loja de Produtor
|
||||
sell_your_produce: 'Venda seus próprios produtos '
|
||||
producer_shop_description_text: Venda seus produtos diretamente aos compradores através da sua própria loja virtual na Open Food Brasil.
|
||||
producer_shop_description_text2: Uma loja de produtor é apenas para o seu produto, se você quiser vender produtos produzidos por outras pessoas ou locais, selecione 'Central de produtor'.
|
||||
producer_shop_description_text2: Uma Loja de Produtor vende ou distribui apenas produtos próprios. Se você quiser vender produtos produzidos por outras pessoas ou iniciativas, selecione 'Central de Produtor'.
|
||||
producer_hub: Central de produtor
|
||||
producer_hub_text: Comercialize seus próprios produtos e de outros produtores
|
||||
producer_hub_description_text: Sua iniciativa é a espinha dorsal do seu sistema de produção e consumo local. Você pode comercializar seus próprios bens, assim como produtos agregados de outras iniciativas e produtores, através da sua loja na Open Food Brasil.
|
||||
producer_hub_description_text: Escolha este tipo de perfil se a sua iniciativa funciona como um intermediário, ou seja, ela vende / distribui produtos seus e de outros produtores também
|
||||
profile: Perfil Simples
|
||||
get_listing: Obter uma listagem
|
||||
profile_description_text: As pessoas podem te encontrar e te contactar na Open Food Brasil. Sua iniciativa estará visível no mapa e poderá ser encontrada em buscas.
|
||||
@@ -874,7 +874,7 @@ pt_BR:
|
||||
next_step: Próximo passo
|
||||
choose_starting_point: 'Escolha o seu tipo de perfil:'
|
||||
profile: 'Perfil'
|
||||
producer_profile: 'Perfil do produtor'
|
||||
producer_profile: 'Perfil Simples'
|
||||
invite_manager:
|
||||
user_already_exists: "Usuário já existe"
|
||||
error: "Algo deu errado"
|
||||
@@ -1015,10 +1015,10 @@ pt_BR:
|
||||
unitsize: Unidade de Medida
|
||||
total: TOTAL
|
||||
total_items: TOTAL DE ITEMS
|
||||
supplier_totals: Total do fornecedor do ciclo de pedidos
|
||||
supplier_totals_by_distributor: Total do fornecedor do ciclo de pedidos por distribuidor
|
||||
totals_by_supplier: Total do distribuidor do ciclo da pedidos pelo fornecedor
|
||||
customer_totals: Total do consumidor do ciclo de pedidos
|
||||
supplier_totals: 'Fechamento do Ciclo: por Fornecedor'
|
||||
supplier_totals_by_distributor: 'Fechamento do Ciclo: por Fornecedor / Distribuidor'
|
||||
totals_by_supplier: 'Fechamento do Ciclo: por Distribuidor / Fornecedor'
|
||||
customer_totals: 'Fechamento do Ciclo: por Consumidor'
|
||||
all_products: Todos os produtos
|
||||
inventory: Inventário (disponível)
|
||||
lettuce_share: LettuceShare
|
||||
@@ -1198,8 +1198,8 @@ pt_BR:
|
||||
mobile_menu:
|
||||
cart: "Carrinho"
|
||||
register_call:
|
||||
selling_on_ofn: "Interessado em registrar a sua iniciativa na Open Food Brasil?"
|
||||
register: "Registre-se aqui"
|
||||
selling_on_ofn: "Quer fazer parte da Open Food Brasil?"
|
||||
register: "Registre aqui a sua iniciativa"
|
||||
footer:
|
||||
footer_secure: "Seguro e confiável."
|
||||
footer_secure_text: "A Open Food Brasil utiliza a criptografia SSL (2048 bit RSA) para manter suas informações em segurança. Nossos servidores não guardam os detalhes do seu cartão de crédito e os pagamentos são processados por serviços compatíveis com PCI."
|
||||
@@ -1812,7 +1812,7 @@ pt_BR:
|
||||
steps:
|
||||
introduction:
|
||||
registration_greeting: "Olá!"
|
||||
registration_intro: "Você pode criar um perfil de produtor ou central"
|
||||
registration_intro: "Vamos criar um perfil para a sua iniciativa? "
|
||||
registration_checklist: "O que eu preciso?"
|
||||
registration_time: "5-10 minutos"
|
||||
registration_enterprise_address: "Endereço da iniciativa"
|
||||
@@ -1822,14 +1822,14 @@ pt_BR:
|
||||
registration_about_us: "'Sobre Nós'"
|
||||
registration_outcome_headline: "O que eu ganho?"
|
||||
registration_outcome1_html: "Seu perfil ajuda as pessoas a te <strong>encontrarem</strong> e entrarem em <strong>contato</strong> com você na Open Food Brasil."
|
||||
registration_outcome2: "Use esse espaço para contar a história da sua iniciativa e ajudar a impulsionar as conexões com sua presença social e online."
|
||||
registration_outcome3: "Esse é também o primeiro passo para começar a comercializar na Open Food Brasil, ou abrir uma loja online."
|
||||
registration_outcome2: "Use esse espaço para contar a história da sua iniciativa e divulgar o seu trabalho."
|
||||
registration_outcome3: "Esse é também o primeiro passo para começar a fornecer ou comercializar seus produtos na Open Food Brasil."
|
||||
registration_action: "Vamos começar!"
|
||||
details:
|
||||
title: "Detalhes"
|
||||
headline: "Vamos começar"
|
||||
enterprise: "Woot! Primeiro, você precisa conhecer um pouco da sua empresa:"
|
||||
producer: "Primeiro precisamos saber mais sobre sua produção:"
|
||||
enterprise: "Boa! Primeiro, precisamos saber um pouco mais sobre a sua iniciativa:"
|
||||
producer: "Boa! Primeiro, precisamos saber um pouco mais sobre a sua produção:"
|
||||
enterprise_name_field: "Nome da iniciativa:"
|
||||
producer_name_field: "Nome da Produção"
|
||||
producer_name_field_placeholder: "ex. Fazenda da Nina"
|
||||
@@ -1863,9 +1863,9 @@ pt_BR:
|
||||
yes_producer: "Sim, sou um produtor"
|
||||
no_producer: "Não, não sou um produtor"
|
||||
producer_field_error: "Por favor escolha um. Você é um produtor?"
|
||||
yes_producer_help: "Produtores fazem coisas deliciosas de comer e beber. "
|
||||
yes_producer_help: "Produtores são aqueles que cultivam, colhem, beneficiam, cozinham, preparam e produzem alimentos e/ou produtos artesanais. "
|
||||
no_producer_help: "Se você não é um produtor, você provavelmente é alguém que vende e distribui alimentos. Você pode ser uma cooperativa, grupo de consumo, varejista, atacadista ou outro. Nos referimos a você como central, já que centraliza pessoas e produtos, independente do modelo organizacional. "
|
||||
create_profile: "Crir perfil"
|
||||
create_profile: "Criar perfil"
|
||||
about:
|
||||
title: "Sobre"
|
||||
headline: "Boa!"
|
||||
@@ -2468,15 +2468,14 @@ pt_BR:
|
||||
profile_only_text3: >
|
||||
Adicione seus produtos à Open Food Brasil, permitindo que as centrais
|
||||
armazenem seus produtos em suas lojas.
|
||||
producer_shop: Loja do produtor
|
||||
producer_shop: Loja de Produtor
|
||||
producer_shop_text1: >
|
||||
Venda os seus produtos diretamente aos compradores através da sua própria
|
||||
loja na Open Food Brasil.
|
||||
producer_shop_text2: >
|
||||
Uma loja de produtor é individual, somente para comercialização de produtos
|
||||
feitos por você. Se quiser vender bens produzidos em outros lugares
|
||||
e/ou pessoas, para além dos seus próprios, por favor selecione 'Central
|
||||
de Produtor'.
|
||||
Uma Loja de Produtor comercializa ou distribui somente produções próprias.
|
||||
Se quiser movimentar bens produzidos por outras pessoas ou iniciativas,
|
||||
além dos seus próprios, por favor selecione 'Central de Produtor'.
|
||||
producer_hub: Central de produtor
|
||||
producer_hub_text1: >
|
||||
A sua iniciativa é a espinha dorsal do seu sistema de produção e consumo
|
||||
@@ -2498,8 +2497,8 @@ pt_BR:
|
||||
enterprise_producer:
|
||||
producer: Produtor
|
||||
producer_text1: >
|
||||
Os produtores fazem coisas deliciosas para comer ou beber. Você é um
|
||||
produtor se você cultiva, cria, prepara, cozinha, fermenta, ou ordenha.
|
||||
Produtores são aqueles que cultivam, colhem, beneficiam, cozinham, preparam
|
||||
e produzem alimentos e/ou produtos artesanais.
|
||||
producer_text2: >
|
||||
Os produtores também podem desempenhar outras funções, como agregar
|
||||
alimentos de outras iniciativas e vendê-lo através de uma loja da Open
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20200912190210) do
|
||||
ActiveRecord::Schema.define(version: 20201113163227) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -49,6 +49,7 @@ If you are using Windows and having issues related to the ruby-build not finding
|
||||
* docker/build: This script builds the Docker containers specified for this app, seeds the database, and logs the screen output for these operations. After you use "git clone" to download this repository, run the docker/build script to start the setup process.
|
||||
* docker/server: Use this script to run this app in the Rails server. This script executes the "docker-compose up" command and logs the results. If all goes well, you will be able to view this app on your local browser at http://localhost:3000/.
|
||||
* docker/test: Use this script to run the entire test suite.
|
||||
* docker/qtest: Use this script to run the entire test suite in quiet mode. The deprecation warnings are removed to make the test results easier to read.
|
||||
* docker/run: Use this script to run commands within the Docker container. If you want shell access, enter "docker/run bash". To execute "ls -l" within the Docker container, enter "docker/run ls -l".
|
||||
* docker/seed: Use this script to seed the database. Please note that this process is not compatible with simultaneously running the Rails server or tests.
|
||||
* docker/nuke: Use this script to delete all Docker images and containers. This fully resets your Docker setup and is useful for making sure that the setup procedure specified for this app is complete.
|
||||
|
||||
9
docker/qtest
Executable file
9
docker/qtest
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script runs the entire test suite AND logs the screen output.
|
||||
# This is the quiet version of docker/test.
|
||||
# The deprecation warnings that obscure the test results are omitted.
|
||||
|
||||
DATE=`date +%Y%m%d-%H%M%S-%3N`
|
||||
docker/qtest-log 2>&1 | tee log/qtest-$DATE.log
|
||||
17
docker/qtest-log
Executable file
17
docker/qtest-log
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo '--------------------------------------------------------------'
|
||||
echo 'BEGIN: docker-compose run web bundle exec rake db:test:prepare'
|
||||
echo '--------------------------------------------------------------'
|
||||
docker-compose run web bundle exec rake db:test:prepare
|
||||
echo '------------------------------------------------------------'
|
||||
echo 'END: docker-compose run web bundle exec rake db:test:prepare'
|
||||
echo '------------------------------------------------------------'
|
||||
|
||||
echo '--------------------------------------'
|
||||
echo 'BEGIN: running test suite (quiet mode)'
|
||||
echo '--------------------------------------'
|
||||
docker-compose run web bundle exec rspec spec | grep -v 'DEPRECATION WARNING' | grep -v 'Post.includes(:comments)' | grep -v 'Currently, Active Record recognizes the table in the string' | grep -v "If you don't rely on implicit join references"
|
||||
echo '------------------------------------'
|
||||
echo 'END: running test suite (quiet mode)'
|
||||
echo '------------------------------------'
|
||||
64
lib/tasks/subscriptions/debug.rake
Normal file
64
lib/tasks/subscriptions/debug.rake
Normal file
@@ -0,0 +1,64 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# rubocop:disable Metrics/BlockLength
|
||||
namespace :ofn do
|
||||
namespace :subs do
|
||||
namespace :debug do
|
||||
desc "Print standard info about a specific Order Cycle"
|
||||
task order_cycle: :environment do
|
||||
order_cycle_id = request_order_cycle_id
|
||||
|
||||
order_cycle = OrderCycle.find_by(id: order_cycle_id)
|
||||
puts "Order Cycle #{order_cycle.name}"
|
||||
order_cycle.schedules.each do |schedule|
|
||||
puts "Schedule #{schedule.name}"
|
||||
Subscription.where(schedule_id: schedule.id).each do |subscription|
|
||||
puts
|
||||
puts "Subscription #{subscription.id}"
|
||||
puts subscription.shop.name
|
||||
puts subscription.customer.email
|
||||
puts subscription.payment_method.name
|
||||
puts "Active from #{subscription.begins_at} to #{subscription.ends_at}"
|
||||
puts "Last edited on #{subscription.updated_at}"
|
||||
puts "Canceled at #{subscription.canceled_at} and paused at #{subscription.paused_at}"
|
||||
|
||||
ProxyOrder.where(order_cycle_id: order_cycle_id,
|
||||
subscription_id: subscription.id).each do |proxy_order|
|
||||
puts
|
||||
puts "Proxy Order #{proxy_order.id}"
|
||||
puts "Canceled at #{proxy_order.canceled_at}"
|
||||
puts "Last updated at #{proxy_order.updated_at}"
|
||||
puts "Placed at #{proxy_order.placed_at}"
|
||||
puts "Confirmed at #{proxy_order.confirmed_at}"
|
||||
|
||||
puts
|
||||
puts "Order #{proxy_order.order_id} - #{proxy_order.order.number}"
|
||||
puts "Order is #{proxy_order.order.state} with total #{proxy_order.order.total}"
|
||||
proxy_order.order.payments.each do |payment|
|
||||
puts "Payment #{payment.id} with state #{payment.state}"
|
||||
puts "Amount #{payment.amount}"
|
||||
puts "Source #{payment.source_type} #{payment.source_id}"
|
||||
if payment.source_type == "Spree::CreditCard"
|
||||
puts "Source #{payment.source.to_json}"
|
||||
end
|
||||
Spree::LogEntry.where(source_type: "Spree::Payment",
|
||||
source_id: payment.id).each do |log_entry|
|
||||
puts "Log Entries found"
|
||||
puts log_entry.details
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def request_order_cycle_id
|
||||
puts "Please input Order Cycle ID to debug"
|
||||
input = STDIN.gets.chomp
|
||||
exit if input.blank? || !Integer(input)
|
||||
Integer(input)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/BlockLength
|
||||
@@ -27,6 +27,23 @@ module Spree
|
||||
spree_post :confirm, payment_method_id: payment_method.id
|
||||
expect(session[:access_token]).to eq(controller.current_order.token)
|
||||
end
|
||||
|
||||
context "if the stock ran out whilst the payment was being placed" do
|
||||
before do
|
||||
allow(controller.current_order).to receive(:insufficient_stock_lines).and_return(true)
|
||||
end
|
||||
|
||||
it "redirects to the cart with out of stock error" do
|
||||
expect(spree_post(:confirm, payment_method_id: payment_method.id)).
|
||||
to redirect_to cart_path
|
||||
|
||||
order = controller.current_order.reload
|
||||
|
||||
# Order is in "cart" state and did not complete processing of the payment
|
||||
expect(order.state).to eq "cart"
|
||||
expect(order.payments.count).to eq 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#expire_current_order' do
|
||||
|
||||
@@ -3,6 +3,8 @@ require "spec_helper"
|
||||
feature "Check out with Paypal", js: true do
|
||||
include ShopWorkflow
|
||||
include CheckoutHelper
|
||||
include AuthenticationHelper
|
||||
include PaypalHelper
|
||||
|
||||
let(:distributor) { create(:distributor_enterprise) }
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
@@ -34,6 +36,7 @@ feature "Check out with Paypal", js: true do
|
||||
distributor_ids: [distributor.id]
|
||||
)
|
||||
end
|
||||
let(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
distributor.shipping_methods << free_shipping
|
||||
@@ -41,23 +44,43 @@ feature "Check out with Paypal", js: true do
|
||||
add_product_to_cart order, product
|
||||
end
|
||||
|
||||
describe "as a guest" do
|
||||
context "as a guest" do
|
||||
it "fails with an error message" do
|
||||
visit checkout_path
|
||||
checkout_as_guest
|
||||
fill_out_form(free_shipping.name, paypal.name, save_default_addresses: false)
|
||||
|
||||
paypal_response = double(:response, success?: false, errors: [])
|
||||
paypal_provider = double(
|
||||
:provider,
|
||||
build_set_express_checkout: nil,
|
||||
set_express_checkout: paypal_response
|
||||
)
|
||||
allow_any_instance_of(Spree::PaypalController).to receive(:provider).
|
||||
and_return(paypal_provider)
|
||||
stub_paypal_response success: false
|
||||
|
||||
place_order
|
||||
expect(page).to have_content "PayPal failed."
|
||||
end
|
||||
end
|
||||
|
||||
context "as a registered user" do
|
||||
before { login_as user }
|
||||
|
||||
it "completes the checkout after successful Paypal payment" do
|
||||
visit checkout_path
|
||||
fill_out_details
|
||||
fill_out_form(free_shipping.name, paypal.name, save_default_addresses: false)
|
||||
|
||||
# Normally the checkout would redirect to Paypal, a form would be filled out there, and the
|
||||
# user would be redirected back to #confirm_paypal_path. Here we skip the PayPal part and
|
||||
# jump straight to being redirected back to OFN with a "confirmed" payment.
|
||||
stub_paypal_response(
|
||||
success: true,
|
||||
redirect: spree.confirm_paypal_path(
|
||||
payment_method_id: paypal.id, token: "t123", PayerID: 'p123'
|
||||
)
|
||||
)
|
||||
stub_paypal_confirm
|
||||
|
||||
place_order
|
||||
expect(page).to have_content "Your order has been processed successfully"
|
||||
|
||||
expect(order.reload.state).to eq "complete"
|
||||
expect(order.payments.count).to eq 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe "checking out an order with a paypal express payment method", type: :request do
|
||||
include ShopWorkflow
|
||||
include PaypalHelper
|
||||
|
||||
let!(:address) { create(:address) }
|
||||
let!(:shop) { create(:enterprise) }
|
||||
@@ -25,18 +26,6 @@ describe "checking out an order with a paypal express payment method", type: :re
|
||||
)
|
||||
end
|
||||
let(:params) { { token: 'lalalala', PayerID: 'payer1', payment_method_id: payment_method.id } }
|
||||
let(:mocked_xml_response) {
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<Envelope><Body>
|
||||
<GetExpressCheckoutDetailsResponse>
|
||||
<Ack>Success</Ack>
|
||||
<PaymentDetails>Something</PaymentDetails>
|
||||
<DoExpressCheckoutPaymentResponseDetails>
|
||||
<PaymentInfo><TransactionID>s0metran$act10n</TransactionID></PaymentInfo>
|
||||
</DoExpressCheckoutPaymentResponseDetails>
|
||||
</GetExpressCheckoutDetailsResponse>
|
||||
</Body></Envelope>"
|
||||
}
|
||||
|
||||
before do
|
||||
order.reload.update_totals
|
||||
@@ -45,8 +34,7 @@ describe "checking out an order with a paypal express payment method", type: :re
|
||||
expect(order.next).to be true # => payment
|
||||
set_order order
|
||||
|
||||
stub_request(:post, "https://api-3t.sandbox.paypal.com/2.0/")
|
||||
.to_return(status: 200, body: mocked_xml_response )
|
||||
stub_paypal_confirm
|
||||
end
|
||||
|
||||
context "with a flat percent calculator" do
|
||||
|
||||
37
spec/support/request/paypal_helper.rb
Normal file
37
spec/support/request/paypal_helper.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PaypalHelper
|
||||
# Initial request to confirm the payment can be placed (before redirecting to paypal)
|
||||
def stub_paypal_response(options)
|
||||
paypal_response = double(:response, success?: options[:success], errors: [])
|
||||
paypal_provider = double(
|
||||
:provider,
|
||||
build_set_express_checkout: nil,
|
||||
set_express_checkout: paypal_response,
|
||||
express_checkout_url: options[:redirect]
|
||||
)
|
||||
allow_any_instance_of(Spree::PaypalController).to receive(:provider).
|
||||
and_return(paypal_provider)
|
||||
end
|
||||
|
||||
# Additional request to re-confirm the payment, when the order is finalised.
|
||||
def stub_paypal_confirm
|
||||
stub_request(:post, "https://api-3t.sandbox.paypal.com/2.0/")
|
||||
.to_return(status: 200, body: mocked_xml_response )
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mocked_xml_response
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<Envelope><Body>
|
||||
<GetExpressCheckoutDetailsResponse>
|
||||
<Ack>Success</Ack>
|
||||
<PaymentDetails>Something</PaymentDetails>
|
||||
<DoExpressCheckoutPaymentResponseDetails>
|
||||
<PaymentInfo><TransactionID>s0metran$act10n</TransactionID></PaymentInfo>
|
||||
</DoExpressCheckoutPaymentResponseDetails>
|
||||
</GetExpressCheckoutDetailsResponse>
|
||||
</Body></Envelope>"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user