should handle case of no payouts.
This commit is contained in:
@@ -430,25 +430,27 @@
|
||||
:body
|
||||
:payouts
|
||||
(fn [payouts]
|
||||
(->> payouts
|
||||
(s/->source)
|
||||
(s/map (fn [payout]
|
||||
(mu/with-context lc
|
||||
(log/info ::looking-up-payout
|
||||
:payout-id (:id payout))
|
||||
(de/chain
|
||||
(manifold-api-call
|
||||
{:url (str "https://connect.squareup.com/v2/payouts/" (:id payout) "/payout-entries")
|
||||
:method :get
|
||||
:headers (client-base-headers client "2023-04-19")
|
||||
:as :json})
|
||||
:body
|
||||
:payout_entries
|
||||
(fn [b]
|
||||
(assoc payout :payout_entries b))))))
|
||||
(s/buffer 10)
|
||||
(s/realize-each)
|
||||
(s/reduce conj [])))))))
|
||||
(if (seq payouts)
|
||||
(->> payouts
|
||||
(s/->source)
|
||||
(s/map (fn [payout]
|
||||
(mu/with-context lc
|
||||
(log/info ::looking-up-payout
|
||||
:payout-id (:id payout))
|
||||
(de/chain
|
||||
(manifold-api-call
|
||||
{:url (str "https://connect.squareup.com/v2/payouts/" (:id payout) "/payout-entries")
|
||||
:method :get
|
||||
:headers (client-base-headers client "2023-04-19")
|
||||
:as :json})
|
||||
:body
|
||||
:payout_entries
|
||||
(fn [b]
|
||||
(assoc payout :payout_entries b))))))
|
||||
(s/buffer 10)
|
||||
(s/realize-each)
|
||||
(s/reduce conj []))
|
||||
[]))))))
|
||||
|
||||
(defn transformed-payouts
|
||||
([client location]
|
||||
|
||||
Reference in New Issue
Block a user