1 /*
2  * Copyright 2013-2018  Christian Dávid <christian-david@web.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SEPAONLINETRANSFERIMPL_H
19 #define SEPAONLINETRANSFERIMPL_H
20 
21 #include "kmm_mymoney_export.h"
22 
23 #include "sepaonlinetransfer.h"
24 #include "mymoneymoney.h"
25 
26 /**
27  * @brief SEPA Credit Transfer
28  */
29 class KMM_MYMONEY_EXPORT sepaOnlineTransferImpl : public sepaOnlineTransfer
30 {
31 
32 public:
33   ONLINETASK_META(sepaOnlineTransfer, "org.kmymoney.creditTransfer.sepa");
34   sepaOnlineTransferImpl();
35   sepaOnlineTransferImpl(const sepaOnlineTransferImpl &other);
36 
responsibleAccount()37   QString responsibleAccount() const final override {
38     return _originAccount;
39   }
40   void setOriginAccount(const QString& accountId) final override;
41 
value()42   MyMoneyMoney value() const final override{
43     return _value;
44   }
setValue(MyMoneyMoney value)45   void setValue(MyMoneyMoney value) final override {
46     _value = value;
47   }
48 
setBeneficiary(const payeeIdentifiers::ibanBic & accountIdentifier)49   void setBeneficiary(const payeeIdentifiers::ibanBic& accountIdentifier) final override {
50     _beneficiaryAccount = accountIdentifier;
51   }
beneficiary()52   payeeIdentifier beneficiary() const final override {
53     return payeeIdentifier(_beneficiaryAccount.clone());
54   }
beneficiaryTyped()55   payeeIdentifiers::ibanBic beneficiaryTyped() const final override {
56     return _beneficiaryAccount;
57   }
58 
setPurpose(const QString purpose)59   void setPurpose(const QString purpose) final override {
60     _purpose = purpose;
61   }
purpose()62   QString purpose() const final override {
63     return _purpose;
64   }
65 
setEndToEndReference(const QString & reference)66   void setEndToEndReference(const QString& reference) final override {
67     _endToEndReference = reference;
68   }
endToEndReference()69   QString endToEndReference() const final override {
70     return _endToEndReference;
71   }
72 
73   payeeIdentifier originAccountIdentifier() const final override;
74 
75   MyMoneySecurity currency() const final override;
76 
77   bool isValid() const final override;
78 
79   QString jobTypeName() const final override;
80 
textKey()81   unsigned short int textKey() const final override {
82     return _textKey;
83   }
84 
setTextKey(unsigned short int textKey)85   void setTextKey(unsigned short int textKey) final override {
86     _textKey = textKey;
87   }
88 
subTextKey()89   unsigned short int subTextKey() const final override {
90     return _subTextKey;
91   }
92 
setSubTextKey(unsigned short int subTextKey)93   void setSubTextKey(unsigned short int subTextKey) final override {
94     _subTextKey = subTextKey;
95   }
96 
97   bool hasReferenceTo(const QString& id) const final override;
98 
99   QSharedPointer<const sepaOnlineTransfer::settings> getSettings() const final override;
100 
101   void writeXML(QDomDocument& document, QDomElement& parent) const final override;
102 
103 protected:
104   sepaOnlineTransfer* clone() const final override;
105 
106   sepaOnlineTransfer* createFromXml(const QDomElement &element) const final override;
107 
108 private:
109   mutable QSharedPointer<const settings> _settings;
110 
111   QString _originAccount;
112   MyMoneyMoney _value;
113   QString _purpose;
114   QString _endToEndReference;
115 
116   payeeIdentifiers::ibanBic _beneficiaryAccount;
117 
118   unsigned short int _textKey;
119   unsigned short int _subTextKey;
120 };
121 
122 #endif // SEPAONLINETRANSFERIMPL_H
123