paymentlib/remote/
payment_remote.rsuse common::remote::{post, services};
use hyper::HeaderMap;
use uuid::Uuid;
use crate::dto::payment_request::PaymentRequest;
use crate::dto::payment_response::PaymentResponse;
pub fn create_payment(headers: HeaderMap, dto: PaymentRequest) -> Result<PaymentResponse, String> {
post::<_, PaymentResponse>(
services::PAYMENT_API,
String::from("/payment"),
headers,
dto,
)
}
pub fn refund(headers: HeaderMap, id: Uuid) -> Result<PaymentResponse, String> {
post(
services::PAYMENT_API,
format!("/payment/refund/{}", id),
headers,
"",
)
}
pub fn refund_credit(headers: HeaderMap, id: Uuid) -> Result<PaymentResponse, String> {
post(
services::PAYMENT_API,
format!("/payment/refundCredit/{}", id),
headers,
"",
)
}