Browse Source

Ensure that backend renders the sisow creditcard correctly

tags/0.9.2^2
Bèr Kessels 9 months ago
parent
commit
9ee0297243

+ 8
- 0
app/views/spree/admin/payments/source_forms/_creditcard.html.erb View File

@@ -0,0 +1,8 @@
<% content_for :head do %>
<script type="text/javascript">
jQuery(document).ready(function(){
$("label:contains('<%= payment_method.name %>')").hide();
$("label:contains('<%= payment_method.name %>') input").disable();
});
</script>
<% end %>

+ 33
- 0
app/views/spree/admin/payments/source_views/_creditcard.html.erb View File

@@ -0,0 +1,33 @@
<fieldset>
<legend><%= Spree.t(:sisow_creditcard) %></legend>

<table class="index">
<tr>
<th colspan="6"><%= Spree.t(:sisow_transaction) %></th>
</tr>
<tr>
<td><label><%= Spree.t(:sisow_transaction_id) %>:</label></td>
<td>
<%= payment.source.transaction_id %>
</td>
</tr>
<tr>
<td><label><%= Spree.t(:sisow_entrance_code) %>:</label></td>
<td>
<%= payment.source.entrance_code %>
</td>
</tr>
<tr>
<td><label><%= Spree.t(:sisow_status) %>:</label></td>
<td>
<%= payment.source.status %>
</td>
</tr>
<tr>
<td><label><%= Spree.t(:sisow_sha1) %>:</label></td>
<td>
<%= payment.source.sha1 %>
</td>
</tr>
</table>
</fieldset>

+ 1
- 0
config/locales/en.yml View File

@@ -2,6 +2,7 @@ en:
spree:
sisow_ideal: "Sisow Ideal"
sisow_bancontact: "Sisow Bancontact"
sisow_creditcard: "Sisow Creditcard"
sisow_sofort: "Sisow Sofort"
sisow_paypalec: "Sisow Paypal Express Checkout"
bank_selection: "Select your bank"

+ 1
- 0
config/locales/nl.yml View File

@@ -2,6 +2,7 @@ nl:
spree:
sisow_ideal: "Sisow Ideal"
sisow_bancontact: "Sisow Bancontact"
sisow_creditcard: "Sisow Creditcard"
sisow_sofort: "Sisow Sofort"
sisow_paypalec: "Sisow Paypal Express Checkout"
bank_selection: "Selecteer uw bank"

+ 58
- 0
spec/features/administer_spec.rb View File

@@ -44,5 +44,63 @@ feature "Administer" do
expect(page).to have_checked_field "Debug mode"
end
end

context "initialiate payments in backend" do
let(:user) { create(:user) }
let(:order) { OrderWalkthrough.up_to(:delivery) }
let(:sisow_request_url) do
"http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx/TransactionRequest"
end
let(:redirect_url_response) { stored_response("ideal_redirect_url_output") }
let(:sisow_request_params) do
{ amount: "2999",
callbackurl: "http://www.example.com/sisow/#{order.number}",
cancelurl: "http://www.example.com/orders/#{order.number}/checkout/sisow_cancel",
description: "Spree Test Store - Order: #{order.number}",
issuerid: "09", # Triodos Bank
merchantid: '2537407799',
notifyurl: "http://www.example.com/sisow/#{order.number}",
payment: "ideal",
purchaseid: order.number,
returnurl: "http://www.example.com/orders/#{order.number}/checkout/sisow_return",
shop_id: "" }
end

before do
stub_user_with_order(user, order)

stub_request(:get, sisow_request_url).
with(query: hash_including(sisow_request_params)).
to_return(redirect_url_response)

visit spree.admin_orders_path
uncheck "Only show complete orders"
click_button "Filter Results"
end

it "can pay with iDeal" do
Spree::PaymentMethod::SisowBilling::Ideal.create!(name: "iDeal")

click_link order.number
click_link "Payments"
choose "iDeal"
click_button "Update"

# We need to fix this bug.
expect(page).to have_content("Source can't be blank")
end

it "can pay with creditcard" do
Spree::PaymentMethod::SisowBilling::Creditcard.create!(name: "CC")

click_link order.number
click_link "Payments"
choose "CC"
click_button "Update"

# We need to fix this bug.
expect(page).to have_content("Source can't be blank")
end
end
end
end

Loading…
Cancel
Save