Browse Source

beneficiary delete api success

v0.17
Suraj Lohani 1 year ago
parent
commit
7581dcbfa9
  1. 5
      GME Remit/APIs/Router/APIRouter.swift
  2. 4
      GME Remit/Modules/BeneficiaryDetail/Application Logic/Interactor/BeneficiaryDetailInteractor.swift
  3. 2
      GME Remit/Modules/BeneficiaryDetail/Application Logic/Interactor/BeneficiaryDetailInteractorIO.swift
  4. 18
      GME Remit/Modules/BeneficiaryDetail/Application Logic/Service/BeneficiaryDetailService.swift
  5. 6
      GME Remit/Modules/BeneficiaryDetail/Application Logic/Service/BeneficiaryDetailServiceType.swift
  6. 2
      GME Remit/Modules/BeneficiaryDetail/Module Interface/BeneficiaryDetailModuleInterface.swift
  7. 4
      GME Remit/Modules/BeneficiaryDetail/User Interface/Presenter/BeneficiaryDetailPresenter.swift
  8. 42
      GME Remit/Modules/BeneficiaryDetail/User Interface/View/BeneficiaryDetail.storyboard
  9. 16
      GME Remit/Modules/BeneficiaryDetail/User Interface/View/BeneficiaryDetailViewController.swift
  10. 7
      GME Remit/Modules/BeneficiaryDetail/User Interface/View/BeneficiaryTableViewCell.swift
  11. 2
      GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift

5
GME Remit/APIs/Router/APIRouter.swift

@ -68,7 +68,7 @@ enum APIRouter {
case fetchCountriesAndServiceTypes(username: String)
case addRecipient(senderID: String, recipient: Recipient)
case editRecipient(senderID: String, recipient: Recipient)
case deleteRecipient(senderID: String, recipientID: String)
case deleteRecipient(recipientID: String)
case fetchBranches(countryCode: String, bankID: String, branchName: String)
case validateAccount(validateModel: ValidateAccountRequest)
case accountValidatet(request: AccountValidate)
@ -581,7 +581,8 @@ extension APIRouter {
case .editRecipient(let senderID, let recipient):
let recipientID = recipient.receiverID ?? ""
return "\(baseUrlWithoutVersion)v3/mobile/\(senderID)/receiverinfo/modify/\(recipientID)"
case .deleteRecipient(let senderID, let recipientID):
case .deleteRecipient(let recipientID):
let senderID = GMEDB.shared.user.string(.senderId) ?? ""
return "\(baseUrlWithoutVersion)v3/mobile/\(senderID)/receiverinfo/remove/\(recipientID)"
case .fetchBranches(let countryCode, let bankID, let branchName):
return "\(baseUrl)/mobile/sendmoney/load/branch/\(countryCode)/\(bankID)/?search=\(branchName)"

4
GME Remit/Modules/BeneficiaryDetail/Application Logic/Interactor/BeneficiaryDetailInteractor.swift

@ -27,8 +27,8 @@ class BeneficiaryDetailInteractor {
// MARK: BeneficiaryDetail interactor input interface
extension BeneficiaryDetailInteractor: BeneficiaryDetailInteractorInput {
func makeApiRequest() {
self.service.makeApiRequest(success: { (message) in
func makeApiRequest(recipientID: String) {
self.service.makeApiRequest(recipientID: recipientID,success: { (message) in
self.output?.success(message: message ?? "")
}) { (error) in
self.output?.show(error: error)

2
GME Remit/Modules/BeneficiaryDetail/Application Logic/Interactor/BeneficiaryDetailInteractorIO.swift

@ -7,7 +7,7 @@
//
protocol BeneficiaryDetailInteractorInput: class {
func makeApiRequest()
func makeApiRequest(recipientID: String)
}
protocol BeneficiaryDetailInteractorOutput: class {

18
GME Remit/Modules/BeneficiaryDetail/Application Logic/Service/BeneficiaryDetailService.swift

@ -10,22 +10,12 @@ import Foundation
class BeneficiaryDetailService: BeneficiaryDetailServiceType {
func makeApiRequest(
recipientID: String,
success: @escaping (String?) -> Void,
failure: @escaping (Error) -> Void
){
// APIRouter
//// .requestOTP(mobileNumber: mobile)
// .request(
// needsAuthorization: false,
// success: {(response: ResponseMessage) in
// if (response.errorCode ?? "") == "1" {
// let error = NSError(domain: "Network", code: 0, message: response.message ?? "")
// failure(error)
// } else {
// success(response.message ?? "")
// }
// },
// failure: {failure($0)}
// )
APIRouter
.deleteRecipient(recipientID: recipientID)
.json(success: success, failure: failure)
}
}

6
GME Remit/Modules/BeneficiaryDetail/Application Logic/Service/BeneficiaryDetailServiceType.swift

@ -9,8 +9,10 @@
import Foundation
protocol BeneficiaryDetailServiceType: class {
func makeApiRequest(
success: @escaping (String?) -> Void,
failure: @escaping (Error) -> Void
recipientID: String,
success: @escaping (String?) -> Void,
failure: @escaping (Error) -> Void
)
}

2
GME Remit/Modules/BeneficiaryDetail/Module Interface/BeneficiaryDetailModuleInterface.swift

@ -7,7 +7,7 @@
//
protocol BeneficiaryDetailModuleInterface: AnyObject {
func makeApiRequest()
func makeApiRequest(recipientID: String)
func didPressBack()
func gotoSendMoney(_ reciptent: Recipient?,
_ paymentMethod: PaymentMethodModel?)

4
GME Remit/Modules/BeneficiaryDetail/User Interface/Presenter/BeneficiaryDetailPresenter.swift

@ -22,9 +22,9 @@ class BeneficiaryDetailPresenter {
// MARK: BeneficiaryDetail module interface
extension BeneficiaryDetailPresenter: BeneficiaryDetailModuleInterface {
func makeApiRequest(){
func makeApiRequest(recipientID: String){
self.view?.showLoading()
self.interactor?.makeApiRequest()
self.interactor?.makeApiRequest(recipientID: recipientID)
}
func didPressBack() {

42
GME Remit/Modules/BeneficiaryDetail/User Interface/View/BeneficiaryDetail.storyboard

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="HSb-ou-7T5">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="HSb-ou-7T5">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
@ -24,7 +24,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Msg-ak-twI">
<rect key="frame" x="0.0" y="20" width="375" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="SgC-Zr-M2U">
<rect key="frame" x="16" y="16" width="343" height="18"/>
@ -59,7 +59,7 @@
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="nhb-o1-ekZ">
<rect key="frame" x="20" y="70" width="335" height="486"/>
<rect key="frame" x="20" y="50" width="335" height="506"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="BeneficiaryTableViewCell" rowHeight="203" id="Zvf-x1-Wi5" customClass="BeneficiaryTableViewCell" customModule="JME_Remit" customModuleProvider="target">
@ -85,48 +85,48 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZDM-LN-544">
<rect key="frame" x="0.0" y="0.0" width="265" height="195"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" alignment="top" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="DHQ-Um-OF3">
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="1" translatesAutoresizingMaskIntoConstraints="NO" id="DHQ-Um-OF3">
<rect key="frame" x="16" y="16" width="249" height="163"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bank_deposit" translatesAutoresizingMaskIntoConstraints="NO" id="hqc-cx-rzh">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
<rect key="frame" x="0.0" y="61.5" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="2AX-wg-DHd"/>
<constraint firstAttribute="width" constant="40" id="jBV-OA-jx3"/>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="Cnn-41-XDg">
<rect key="frame" x="56" y="0.0" width="193" height="82"/>
<rect key="frame" x="41" y="40.5" width="159" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="IME Pay Mobile Wallet" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ae7-L0-gY3">
<rect key="frame" x="0.0" y="0.0" width="193" height="14"/>
<rect key="frame" x="0.0" y="0.0" width="159" height="14"/>
<fontDescription key="fontDescription" name="FONTSPRINGDEMO-VolteSemiboldRegular" family="FONTSPRING DEMO - Volte Semibold" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="Lh7-U6-fWO">
<rect key="frame" x="0.0" y="22" width="193" height="60"/>
<rect key="frame" x="0.0" y="22" width="159" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID: 9841303676" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="doi-P7-z1R">
<rect key="frame" x="0.0" y="0.0" width="193" height="12"/>
<rect key="frame" x="0.0" y="0.0" width="159" height="12"/>
<fontDescription key="fontDescription" name="FONTSPRINGDEMO-VolteSemiboldRegular" family="FONTSPRING DEMO - Volte Semibold" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID: 9841303676" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O58-Ke-fq6">
<rect key="frame" x="0.0" y="16" width="193" height="12"/>
<rect key="frame" x="0.0" y="16" width="159" height="12"/>
<fontDescription key="fontDescription" name="FONTSPRINGDEMO-VolteSemiboldRegular" family="FONTSPRING DEMO - Volte Semibold" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID: 9841303676" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9uL-wQ-mZd">
<rect key="frame" x="0.0" y="32" width="193" height="12"/>
<rect key="frame" x="0.0" y="32" width="159" height="12"/>
<fontDescription key="fontDescription" name="FONTSPRINGDEMO-VolteSemiboldRegular" family="FONTSPRING DEMO - Volte Semibold" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID: 9841303676" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jsp-NN-jLM">
<rect key="frame" x="0.0" y="48" width="193" height="12"/>
<rect key="frame" x="0.0" y="48" width="159" height="12"/>
<fontDescription key="fontDescription" name="FONTSPRINGDEMO-VolteSemiboldRegular" family="FONTSPRING DEMO - Volte Semibold" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
@ -135,13 +135,25 @@
</stackView>
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sb6-dg-9Kc">
<rect key="frame" x="201" y="57.5" width="48" height="48"/>
<constraints>
<constraint firstAttribute="width" constant="48" id="gJS-vx-kSM"/>
<constraint firstAttribute="height" constant="48" id="wDK-0a-BFM"/>
</constraints>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" image="ic_delete3"/>
<connections>
<action selector="deleteAction:" destination="Zvf-x1-Wi5" eventType="touchUpInside" id="E6X-6Z-oTi"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" red="0.1803921568627451" green="0.53725490196078429" blue="1" alpha="0.038622723509933773" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="DHQ-Um-OF3" firstAttribute="top" secondItem="ZDM-LN-544" secondAttribute="top" constant="16" id="IPG-sG-484"/>
<constraint firstAttribute="trailing" secondItem="DHQ-Um-OF3" secondAttribute="trailing" id="JfO-A7-ABO"/>
<constraint firstAttribute="trailing" secondItem="DHQ-Um-OF3" secondAttribute="trailing" id="Va2-wU-p6e"/>
<constraint firstAttribute="bottom" secondItem="DHQ-Um-OF3" secondAttribute="bottom" constant="16" id="hMX-bV-B8j"/>
<constraint firstItem="DHQ-Um-OF3" firstAttribute="leading" secondItem="ZDM-LN-544" secondAttribute="leading" constant="16" id="s4K-Rw-9Ce"/>
</constraints>
@ -162,6 +174,7 @@
<outlet property="AcBranchLabel" destination="jsp-NN-jLM" id="xDJ-Y2-c78"/>
<outlet property="AcNameLabel" destination="O58-Ke-fq6" id="KVS-Xt-oRd"/>
<outlet property="AcNumberLabel" destination="9uL-wQ-mZd" id="Pks-mP-OJX"/>
<outlet property="deleteButtonOutlet" destination="sb6-dg-9Kc" id="eib-yA-E3c"/>
<outlet property="idNumberLabel" destination="doi-P7-z1R" id="6QK-2D-gYe"/>
<outlet property="indicatorButton" destination="g1X-nk-DT1" id="4vj-vA-Y9D"/>
<outlet property="localizedNameLabel" destination="Ae7-L0-gY3" id="Ksl-Xn-apk"/>
@ -239,6 +252,7 @@
<image name="backIconBlack" width="21" height="16"/>
<image name="bank_deposit" width="54" height="54"/>
<image name="circle" catalog="system" width="128" height="123"/>
<image name="ic_delete3" width="24" height="24"/>
<namedColor name="ThemeBlack">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</namedColor>

16
GME Remit/Modules/BeneficiaryDetail/User Interface/View/BeneficiaryDetailViewController.swift

@ -13,7 +13,11 @@ class BeneficiaryDetailViewController: UIViewController {
// MARK: Properties
var presenter: BeneficiaryDetailModuleInterface?
var reciptent: Recipient?
var reciptent: Recipient? {
didSet {
selectedPayments = reciptent?.paymentMethods?.first
}
}
var selectedPayments: PaymentMethodModel?
// MARK: IBOutlets
@ -83,6 +87,15 @@ extension BeneficiaryDetailViewController: UITableViewDataSource, UITableViewDel
let status = (selectedPayments == reciptent?.paymentMethods?.elementAt(index: indexPath.row))
cell.isSelected(status)
cell.commonSetup(reciptent?.paymentMethods?.elementAt(index: indexPath.row))
cell.onClickDeleteButton = {
self.alertWithOkCancel(type: .normal,message: "Are you sure, You want to delete beneficiary?", title: "Delete Beneficiary", okTitle: "Yes", cancelTitle: "No",
okAction: {
self.presenter?.makeApiRequest(recipientID: self.reciptent?.paymentMethods?.elementAt(index: indexPath.row)?.receiverId ?? "")
}) {
self.dismiss(animated: true)
}
}
return cell
}
@ -142,6 +155,7 @@ extension BeneficiaryDetailViewController: BeneficiaryDetailViewInterface {
title: "Success",
okTitle: "Ok"
) {
self.navigationController?.popViewController(animated: true)
}
}
}

7
GME Remit/Modules/BeneficiaryDetail/User Interface/View/BeneficiaryTableViewCell.swift

@ -13,16 +13,23 @@ class BeneficiaryTableViewCell: UITableViewCell {
@IBOutlet weak var AcBranchLabel: UILabel!
@IBOutlet weak var AcNumberLabel: UILabel!
@IBOutlet weak var localizedNameLabel: UILabel!
@IBOutlet weak var deleteButtonOutlet: UIButton!
static var identifier: String {
return String(describing: self)
}
@IBAction func deleteAction(_ sender: Any) {
self.onClickDeleteButton?()
}
var onClickDeleteButton: (() -> ())?
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
indicatorButton.setTitle("", for: .normal)
deleteButtonOutlet.setTitle("", for: .normal)
walletInfoView.set(cornerRadius: 10)
}

2
GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift

@ -53,7 +53,7 @@ class RecipientsService: RecipientsServiceType {
) {
let id = GMEDB.shared.user.string(.senderId) ?? ""
let recipientID = reciepient.receiverID ?? ""
APIRouter.deleteRecipient(senderID: id, recipientID: recipientID)
APIRouter.deleteRecipient(recipientID: recipientID)
.request(
success: { (response: ResponseContainer<String>) in
if response.errorCode != "0" {

Loading…
Cancel
Save