This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
173 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class Admin::AuctionMarkPaymentsController < Admin::BaseController | ||
def update | ||
@auction = Auction.find(params[:id]) | ||
|
||
paid_auction = MarkPaidAuction.new( | ||
auction: @auction | ||
) | ||
|
||
if paid_auction.perform | ||
@auction.save! | ||
else | ||
error_messages = @auction.errors.full_messages.to_sentence | ||
flash[:error] = error_messages | ||
end | ||
|
||
redirect_to admin_auction_path(@auction) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/presenters/admin_auction_status_presenter/accepted_other_pcard.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class AdminAuctionStatusPresenter::AcceptedOtherPcard < AdminAuctionStatusPresenter::Base | ||
def header | ||
I18n.t('statuses.admin_auction_status_presenter.accepted_other_pcard.header') | ||
end | ||
|
||
def body | ||
I18n.t( | ||
'statuses.admin_auction_status_presenter.accepted_other_pcard.body', | ||
customer_url: customer_url, | ||
accepted_at: accepted_at, | ||
winner_url: winner_url | ||
) | ||
end | ||
|
||
def action_partial | ||
'admin/auctions/mark_paid' | ||
end | ||
|
||
private | ||
|
||
def accepted_at | ||
DcTimePresenter.convert_and_format(auction.accepted_at) | ||
end | ||
|
||
def customer_url | ||
Url.new( | ||
link_text: customer_name, | ||
path_name: 'admin_customer', | ||
params: { id: customer.id } | ||
) | ||
end | ||
|
||
def customer | ||
auction.customer | ||
end | ||
|
||
def customer_name | ||
customer.agency_name | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class MarkPaidAuction | ||
attr_reader :auction | ||
|
||
def initialize(auction:) | ||
@auction = auction | ||
end | ||
|
||
def perform | ||
auction.update(paid_at: Time.now) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%= link_to( | ||
I18n.t('statuses.admin_auction_status_presenter.accepted_other_pcard.actions.mark_paid'), | ||
admin_auction_mark_payment_path(status.auction), | ||
method: :patch, | ||
class: 'usa-button usa-button-outline action-button') %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Feature: Admin views an auction with payment needed from an "other" P-card | ||
As an administrator | ||
I want to see if an auction needs to be paid directly by a customer | ||
So that I can notify them if there is a problem | ||
|
||
Scenario: Admin sees that accepted auction requires payment via other p-card (not 18F) | ||
Given I am an administrator | ||
And I sign in | ||
And there is an accepted auction that needs payment | ||
And the auction is for a different purchase card | ||
And the auction has an associated customer | ||
|
||
When I visit the admin auction page for that auction | ||
Then I should see an admin status message that the auction needs payment from a customer | ||
|
||
Scenario: Mark as paid | ||
Given I am an administrator | ||
And I sign in | ||
And there is an accepted auction that needs payment | ||
And the auction is for a different purchase card | ||
And the auction has an associated customer | ||
|
||
When I visit the admin auction page for that auction | ||
And I mark the auction as paid | ||
# Then I should see the C2 status for an auction with payment confirmation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters