loan order details more beautiful
This commit is contained in:
@@ -301,6 +301,75 @@ class AuthService {
|
||||
async deleteLoanOrder(orderId) {
|
||||
return this.makeRequest(`/loan-order/${orderId}`, null, true, 'DELETE');
|
||||
}
|
||||
|
||||
// ================================
|
||||
// Card Transactions Orders (Kart hereketleri)
|
||||
// ================================
|
||||
|
||||
// LIST
|
||||
async getCardTransactionOrders() {
|
||||
return this.makeRequest('/card-transactions', null, true, 'GET');
|
||||
}
|
||||
|
||||
// CREATE order (auto-fills passport data from stored profile)
|
||||
async createCardTransactionOrder(cardNumber, cardMonth, cardYear, passportSerie = null, passportId = null) {
|
||||
let serie = passportSerie;
|
||||
let pid = passportId;
|
||||
if (!serie || !pid) {
|
||||
const user = await this.getStoredUser();
|
||||
serie = serie || user?.passport_serie;
|
||||
pid = pid || user?.passport_id;
|
||||
}
|
||||
if (!serie || !pid) {
|
||||
throw new Error('Passport details are missing');
|
||||
}
|
||||
const payload = {
|
||||
passport_serie: serie,
|
||||
passport_id: pid,
|
||||
card_number: cardNumber,
|
||||
card_month: cardMonth,
|
||||
card_year: cardYear,
|
||||
};
|
||||
return this.makeRequest('/card-transactions', payload, true, 'POST');
|
||||
}
|
||||
|
||||
// SHOW
|
||||
async getCardTransactionOrder(orderId) {
|
||||
return this.makeRequest(`/card-transactions/${orderId}`, null, true, 'GET');
|
||||
}
|
||||
|
||||
// UPDATE
|
||||
async updateCardTransactionOrder(orderId, cardNumber, cardMonth, cardYear, passportSerie = null, passportId = null) {
|
||||
let serie = passportSerie;
|
||||
let pid = passportId;
|
||||
if (!serie || !pid) {
|
||||
const user = await this.getStoredUser();
|
||||
serie = serie || user?.passport_serie;
|
||||
pid = pid || user?.passport_id;
|
||||
}
|
||||
if (!serie || !pid) {
|
||||
throw new Error('Passport details are missing');
|
||||
}
|
||||
const payload = {
|
||||
passport_serie: serie,
|
||||
passport_id: pid,
|
||||
card_number: cardNumber,
|
||||
card_month: cardMonth,
|
||||
card_year: cardYear,
|
||||
};
|
||||
return this.makeRequest(`/card-transactions/${orderId}`, payload, true, 'POST');
|
||||
}
|
||||
|
||||
// DELETE
|
||||
async deleteCardTransactionOrder(orderId) {
|
||||
return this.makeRequest(`/card-transactions/${orderId}`, null, true, 'DELETE');
|
||||
}
|
||||
|
||||
// DOWNLOAD (returns object with url)
|
||||
async downloadCardTransactions(orderId, startDate, endDate) {
|
||||
const query = `start_date=${encodeURIComponent(startDate)}&end_date=${encodeURIComponent(endDate)}`;
|
||||
return this.makeRequest(`/card-transactions-download/${orderId}?${query}`, null, true, 'GET');
|
||||
}
|
||||
}
|
||||
|
||||
export default new AuthService();
|
||||
Reference in New Issue
Block a user