Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Feat: Convert Service related Interfaces from Java to Kotlin #105

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.apache.fineract.data.services

import io.reactivex.Observable
import org.apache.fineract.data.models.customer.Country
import retrofit2.http.GET

/**
* Created by Ahmad Jawid Muhammadi on 2/6/20
*/
interface AnonymousService {

@GET("http://restcountries.eu/rest/v2/all?fields=name;alpha2Code;translations")
fun getCountries(): Observable<List<Country?>?>?
}

This file was deleted.

21 changes: 21 additions & 0 deletions app/src/main/java/org/apache/fineract/data/services/AuthService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.apache.fineract.data.services

import io.reactivex.Observable
import org.apache.fineract.data.models.Authentication
import org.apache.fineract.data.remote.EndPoints
import retrofit2.http.POST
import retrofit2.http.Query

/**
* Created by Ahmad Jawid Muhammadi on 2/6/20
*/
interface AuthService {

@POST(EndPoints.API_IDENTITY_PATH + "/token?grant_type=password")
fun login(
@Query("username") username: String?,
@Query("password") password: String?): Observable<Authentication?>?

@POST(EndPoints.API_IDENTITY_PATH + "/token?grant_type=refresh_token")
fun refreshToken(): Observable<Authentication?>?
}

This file was deleted.

103 changes: 103 additions & 0 deletions app/src/main/java/org/apache/fineract/data/services/CustomerService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package org.apache.fineract.data.services

import io.reactivex.Completable
import io.reactivex.Observable
import okhttp3.MultipartBody
import org.apache.fineract.data.models.customer.Command
import org.apache.fineract.data.models.customer.Customer
import org.apache.fineract.data.models.customer.CustomerPage
import org.apache.fineract.data.models.customer.identification.Identification
import org.apache.fineract.data.models.customer.identification.ScanCard
import org.apache.fineract.data.remote.EndPoints
import retrofit2.http.*

/**
* Created by Ahmad Jawid Muhammadi on 2/6/20
*/
interface CustomerService {
@GET(EndPoints.API_CUSTOMER_PATH + "/customers")
fun fetchCustomers(
@Query("pageIndex") integer: Int?,
@Query("size") size: Int?): Observable<CustomerPage?>?

@GET(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}")
fun fetchCustomer(@Path("identifier") identifier: String?): Observable<Customer?>?

@PUT(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}")
fun updateCustomer(
@Path("identifier") identifier: String?,
@Body customer: Customer?): Completable?

@GET(EndPoints.API_CUSTOMER_PATH + "/customers")
fun searchCustomer(
@Query("pageIndex") pageIndex: Int?,
@Query("size") size: Int?,
@Query("term") term: String?): Observable<CustomerPage?>?

@POST(EndPoints.API_CUSTOMER_PATH + "/customers")
fun createCustomer(@Body customer: Customer?): Completable?

@POST(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}/commands")
fun customerCommand(@Path("identifier") identifier: String?, @Body command: Command?): Completable?

@GET(EndPoints.API_CUSTOMER_PATH + "/customers/{customerIdentifier}/commands")
fun fetchCustomerCommands(
@Path("customerIdentifier") customerIdentifier: String?): Observable<List<Command?>?>?

@GET(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}/identifications")
fun fetchIdentification(
@Path("identifier") identifier: String?): Observable<List<Identification?>?>?

@GET(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}/identifications/{number}")
fun searchIdentification(
@Path("identifier") identifier: String?, @Path("number") number: String?): Observable<Identification?>?

@POST(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}/identifications")
fun createIdentificationCard(@Path("identifier") identifier: String?,
@Body identification: Identification?): Completable?

@PUT(EndPoints.API_CUSTOMER_PATH +
"/customers/{identifier}/identifications/{identificationNumber}")
fun updateIdentificationCard(
@Path("identifier") identifier: String?,
@Path("identificationNumber") identificationNumber: String?,
@Body identification: Identification?): Completable?

@GET(EndPoints.API_CUSTOMER_PATH +
"/customers/{identifier}/identifications/{identificationnumber}/scans")
fun fetchIdentificationScanCards(
@Path("identifier") identifier: String?,
@Path("identificationnumber") identificationnumber: String?): Observable<List<ScanCard?>?>?

@Multipart
@POST(EndPoints.API_CUSTOMER_PATH +
"/customers/{identifier}/identifications/{identificationnumber}/scans")
fun uploadIdentificationCardScan(
@Path("identifier") identifier: String?,
@Path("identificationnumber") identificationnumber: String?,
@Query("scanIdentifier") scanIdentifier: String?,
@Query("description") description: String?,
@Part file: MultipartBody.Part?): Completable?

@DELETE(EndPoints.API_CUSTOMER_PATH +
"/customers/{identifier}/identifications/{identificationnumber}/scans/{scanIdentifier}")
fun deleteIdentificationCardScan(
@Path("identifier") identifier: String?,
@Path("identificationnumber") identificationnumber: String?,
@Path("scanIdentifier") scanIdentifier: String?): Completable?

@DELETE(EndPoints.API_CUSTOMER_PATH +
"/customers/{identifier}/identifications/{identificationnumber}")
fun deleteIdentificationCard(
@Path("identifier") identifier: String?,
@Path("identificationnumber") identificationnumber: String?): Completable?

@Multipart
@POST(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}/portrait")
fun uploadCustomerPortrait(
@Path("identifier") customerIdentifier: String?,
@Part file: MultipartBody.Part?): Completable?

@DELETE(EndPoints.API_CUSTOMER_PATH + "/customers/{identifier}/portrait")
fun deleteCustomerPortrait(@Path("identifier") customerIdentifier: String?): Completable?
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.apache.fineract.data.services

import io.reactivex.Completable
import io.reactivex.Observable
import org.apache.fineract.data.models.deposit.DepositAccount
import org.apache.fineract.data.models.deposit.ProductDefinition
import org.apache.fineract.data.remote.EndPoints
import retrofit2.http.*

/**
* Created by Ahmad Jawid Muhammadi on 2/6/20
*/
interface DepositService {
@GET(EndPoints.API_DEPOSIT_PATH + "/instances")
fun fetchCustomersDeposits(
@Query("customer") customerIdentifier: String?): Observable<List<DepositAccount?>?>?

@GET(EndPoints.API_DEPOSIT_PATH + "/instances/{accountIdentifier}")
fun fetchCustomerDepositDetails(
@Path("accountIdentifier") accountIdentifier: String?): Observable<DepositAccount?>?

@GET(EndPoints.API_DEPOSIT_PATH + "/definitions")
fun fetchProductDefinitions(): Observable<List<ProductDefinition?>?>?

@POST(EndPoints.API_DEPOSIT_PATH + "/instances")
fun createDepositAccount(@Body depositAccount: DepositAccount?): Completable?

@PUT(EndPoints.API_DEPOSIT_PATH + "/instances/{accountIdentifier}")
fun updateDepositAccount(
@Path("accountIdentifier") accountIdentifier: String?,
@Body depositAccount: DepositAccount?): Completable?
}
Loading