mirror of
https://github.com/valitydev/holmes.git
synced 2024-11-06 01:45:25 +00:00
4cdec0411f
* Switch proto upstreams to valitydev: valitydev/bender-proto@38ce3ff valitydev/binbase-proto@9db92d9 valitydev/cds-proto@ed9f907 valitydev/damsel@d384c12 valitydev/fistful-proto@c45166d valitydev/limiter-proto@8c08550 valitydev/machinegun-proto@af57ba1 valitydev/msgpack-proto@8742c7a * Rewrite Dockerfile * Include protocols as full-fledged git repos * Add GH Actions CI workflow
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
CWD="$(dirname $0)"
|
|
DAMSEL="${CWD}/../damsel"
|
|
SCRIPTNAME="$(basename $0)"
|
|
|
|
source "${CWD}/lib/logging"
|
|
|
|
function usage {
|
|
echo -e "Given ID of an invoice and a payment start payment refund."
|
|
echo
|
|
echo -e "Usage: $(em ${SCRIPTNAME} invoice_id payment_id amount currency)"
|
|
echo -e " $(em invoice_id) Invoice ID (string)."
|
|
echo -e " $(em payment_id) Payment ID (string), $(em 1) by default."
|
|
echo -e " $(em amount) Amount (number)."
|
|
echo -e " $(em currency) Currency code (string)."
|
|
echo
|
|
echo -e "More information:"
|
|
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
|
exit 127
|
|
}
|
|
|
|
INVOICE="${1}"
|
|
PAYMENT="${2}"
|
|
AMOUNT="${3}"
|
|
CURCODE="${4}"
|
|
|
|
[ -z "${INVOICE}" -o -z "${PAYMENT}" -o -z "${AMOUNT}" -o -z "${CURCODE}" ] && usage
|
|
|
|
PARAMS=$(jq -nc "{cash:{amount:${AMOUNT}, currency:{symbolic_code:\"${CURCODE}\"}}}")
|
|
|
|
[ -f woorlrc ] && source woorlrc
|
|
|
|
"${WOORL[@]:-woorl}" \
|
|
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
|
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
|
|
Invoicing RefundPayment "\"${INVOICE}\"" "\"${PAYMENT}\"" "${PARAMS}"
|