| Transaction Data | {:origin #132,:sequence 1,:command (deploy (quote (do (def receipts {}) (def actor-version 1) (defn ^{:callable true} pay [payment-id merchant amount binding-hash] (cond (not (blob? payment-id)) (fail :CAST "payment-id must be a blob") (not (= 32 (count payment-id))) (fail :ARGUMENT "payment-id must be 32 bytes") (not (address? merchant)) (fail :CAST "merchant must be an address") (nil? (account merchant)) (fail :NOBODY "merchant account does not exist") (= merchant *caller*) (fail :ARGUMENT "buyer and merchant must differ") (= merchant *address*) (fail :ARGUMENT "merchant cannot be the payment actor") (not (long? amount)) (fail :CAST "amount must be a long") (<= amount 0) (fail :ARGUMENT "amount must be positive") (not (blob? binding-hash)) (fail :CAST "binding-hash must be a blob") (not (= 32 (count binding-hash))) (fail :ARGUMENT "binding-hash must be 32 bytes") (get receipts payment-id) (fail :STATE "payment-id already accepted") (not (= *offer* amount)) (fail :ARGUMENT "offer must exactly equal amount") :else (let [receipt {:actor *address*,:payment-id payment-id,:version actor-version,:recorded-at *timestamp*,:binding-hash binding-hash,:buyer *caller*,:merchant merchant,:amount amount}] (accept amount) (transfer merchant amount) (set! receipts (assoc receipts payment-id receipt)) receipt))) (defn ^{:callable true} get-receipt [payment-id] (cond (not (blob? payment-id)) (fail :CAST "payment-id must be a blob") (not (= 32 (count payment-id))) (fail :ARGUMENT "payment-id must be 32 bytes") :else (get receipts payment-id))))))} | CVX representation of the transaction |