mirror of
https://github.com/System-End/theseus.git
synced 2026-04-19 22:15:09 +00:00
fix pacc
This commit is contained in:
parent
958878dc18
commit
97a1267f95
3 changed files with 31 additions and 13 deletions
|
|
@ -42,6 +42,7 @@ class USPS::Indicium < ApplicationRecord
|
|||
|
||||
belongs_to :payment_account, foreign_key: :usps_payment_account_id
|
||||
belongs_to :letter, optional: true
|
||||
belongs_to :hcb_payment_account, class_name: "HCB::PaymentAccount", optional: true
|
||||
|
||||
def buy!(payment_token = nil)
|
||||
raise ArgumentError, "for what?" unless letter
|
||||
|
|
|
|||
29
app/views/letters/_buy_indicia_form.html.erb
Normal file
29
app/views/letters/_buy_indicia_form.html.erb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<div class="flex flex-col gap-2">
|
||||
<%= form_with(url: buy_indicia_letter_path(letter), method: :post) do |form| %>
|
||||
<div class="form-group">
|
||||
<label>USPS Payment Account</label>
|
||||
<%= form.collection_select :usps_payment_account_id,
|
||||
USPS::PaymentAccount.all,
|
||||
:id,
|
||||
:name,
|
||||
{ prompt: "Select a payment account", selected: USPS::PaymentAccount.first&.id },
|
||||
{ required: true } %>
|
||||
</div>
|
||||
<% if current_user.hcb_payment_accounts.any? %>
|
||||
<div class="form-group">
|
||||
<label>Pay with HCB Organization</label>
|
||||
<%= form.collection_select :hcb_payment_account_id,
|
||||
current_user.hcb_payment_accounts,
|
||||
:id,
|
||||
:organization_name,
|
||||
{ prompt: "Select an organization" },
|
||||
{ required: true } %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="text-sm text-gray-600">
|
||||
<%= link_to "Connect your HCB account", new_back_office_hcb_oauth_connection_path %> to purchase indicia.
|
||||
</p>
|
||||
<% end %>
|
||||
<%= form.submit "Buy Indicia", class: "primary", disabled: current_user.hcb_payment_accounts.empty? %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -92,19 +92,7 @@
|
|||
Indicia (Metered) - Not Purchased Yet
|
||||
</p>
|
||||
<% if @letter.batch_id.nil? %>
|
||||
<div class="flex items-center gap-4">
|
||||
<%= form_with(url: buy_indicia_letter_path(@letter), method: :post) do |form| %>
|
||||
<div class="form-group">
|
||||
<%= form.collection_select :usps_payment_account_id,
|
||||
USPS::PaymentAccount.all,
|
||||
:id,
|
||||
:name,
|
||||
{ prompt: "Select a payment account", selected: USPS::PaymentAccount.first&.id },
|
||||
{ required: true } %>
|
||||
</div>
|
||||
<%= form.submit "Buy Indicia", class: "primary" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render 'buy_indicia_form', letter: @letter %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif @letter.postage_type == "international_origin" %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue