Add the ability to unautopay
This commit is contained in:
@@ -1056,6 +1056,10 @@
|
||||
:args {:invoice_id {:type :id}}
|
||||
:resolve :mutation/unvoid-invoice}
|
||||
|
||||
:unautopay_invoice {:type :invoice
|
||||
:args {:invoice_id {:type :id}}
|
||||
:resolve :mutation/unautopay-invoice}
|
||||
|
||||
:void_payment {:type :payment
|
||||
:args {:payment_id {:type :id}}
|
||||
:resolve :mutation/void-payment}
|
||||
@@ -1343,6 +1347,7 @@
|
||||
:mutation/merge-vendors gq-vendors/merge-vendors
|
||||
:mutation/void-invoice gq-invoices/void-invoice
|
||||
:mutation/unvoid-invoice gq-invoices/unvoid-invoice
|
||||
:mutation/unautopay-invoice gq-invoices/unautopay-invoice
|
||||
:mutation/void-payment gq-checks/void-check
|
||||
:mutation/edit-expense-accounts gq-invoices/edit-expense-accounts
|
||||
:mutation/import-ledger gq-ledger/import-ledger
|
||||
|
||||
@@ -239,6 +239,18 @@
|
||||
(-> (d-invoices/get-by-id id)
|
||||
(->graphql))))
|
||||
|
||||
(defn unautopay-invoice [context {id :invoice_id} value]
|
||||
(let [invoice (d/entity (d/db conn) id)
|
||||
_ (assert (:invoice/client invoice))
|
||||
_ (assert-can-see-client (:id context) (:db/id (:invoice/client invoice)))]
|
||||
(audit-transact [[:db/add id :invoice/status :invoice-status/unpaid]
|
||||
[:db/add id :invoice/outstanding-balance (:invoice/total invoice)]
|
||||
[:db/retract id :invoice/scheduled-payment (:invoice/scheduled-payment invoice)]]
|
||||
(:id context))
|
||||
|
||||
(-> (d-invoices/get-by-id id)
|
||||
(->graphql))))
|
||||
|
||||
(defn edit-expense-accounts [context args value]
|
||||
(assert-can-see-client (:id context) (:db/id (:invoice/client (d-invoices/get-by-id (:invoice_id args)))))
|
||||
(let [invoice-id (:invoice_id args)
|
||||
|
||||
@@ -192,8 +192,8 @@
|
||||
:returns (+ (- (-> order :return_amounts :total_money amount->money)
|
||||
(-> order :return_amounts :tax_money amount->money)
|
||||
(-> order :return_amounts :tip_money amount->money)
|
||||
(-> order :return_amounts :service_charge_money amount->money)
|
||||
(-> order :return_amounts :discount_money amount->money)))
|
||||
(-> order :return_amounts :service_charge_money amount->money))
|
||||
(-> order :return_amounts :discount_money amount->money))
|
||||
:charges (->> (:tenders order)
|
||||
(map (fn [t]
|
||||
(remove-nils
|
||||
@@ -242,13 +242,13 @@
|
||||
|
||||
(defn settlements [l]
|
||||
(log/info "Searching for" l)
|
||||
(let [settlements (->> (client/get (str "https://connect.squareup.com/v1/" l "/settlements")
|
||||
(let [settlements (->> (client/get (str "https://connect.squareup.com/v1/" l "/settlements?limit=10")
|
||||
{:headers {"Authorization" "Bearer EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"
|
||||
"Content-Type" "application/json"}
|
||||
:as :json})
|
||||
:body
|
||||
(map :id))]
|
||||
(loop [[s & xs] (take 5 settlements)
|
||||
(loop [[s & xs] (take 10 settlements)
|
||||
result []]
|
||||
(log/info "Looking up settlement " s " for location " l)
|
||||
(let [n (:body (retry #(client/get (str "https://connect.squareup.com/v1/" l "/settlements/" s)
|
||||
|
||||
Reference in New Issue
Block a user