캔 내역, 캔 충전 페이지 추가
This commit is contained in:
48
SodaLive/Sources/MyPage/Can/CanRepository.swift
Normal file
48
SodaLive/Sources/MyPage/Can/CanRepository.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// CanRepository.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/10.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CombineMoya
|
||||
import Combine
|
||||
import Moya
|
||||
|
||||
final class CanRepository {
|
||||
private let api = MoyaProvider<CanApi>()
|
||||
|
||||
func getCanStatus() -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getCanStatus)
|
||||
}
|
||||
|
||||
func getCanChargeStatus() -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getCanChargeStatus)
|
||||
}
|
||||
|
||||
func getCanUseStatus() -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getCanUseStatus)
|
||||
}
|
||||
|
||||
func chargeCan(title: String, chargeCan: Int, price: Double, locale: String, paymentGateway: PaymentGateway = .APPLE_IAP) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.chargeCan(request: CanChargeRequest(title: title, chargeCan: chargeCan, paymentGateway: paymentGateway, price: price, locale: locale)))
|
||||
}
|
||||
|
||||
func verify(receiptString: String, chargeId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.verify(request: CanVerifyRequest(receiptString: receiptString, chargeId: chargeId)))
|
||||
}
|
||||
|
||||
func pgChargeCan(canId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.pgChargeCan(request: PgChargeRequest(canId: canId, paymentGateway: .PG)))
|
||||
}
|
||||
|
||||
func pgVerify(receiptId: String, orderId: String) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.pgVerify(request: PgVerifyRequest(receiptId: receiptId, orderId: orderId)))
|
||||
}
|
||||
|
||||
func getCans() -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getCans)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user