<p>This PR's purpose is to show how the API could create any exiting fiat <code>PaymentAccount</code> with a single CLI parameter, using reflection and json.</p>
<p>The idea is to use the CLI to create fiat accounts in four simple steps, as opposed to figuring out how to correctly pass a complicated set of parameters to a CLI <code>createpaymentacct</code> command.  The steps are:</p>
<ol>
<li>
<p>Get a list of payment account method IDs, e.g.,</p>
<p><code>$ getpaymentmethods</code>    -- returns list of payment method IDs and descriptions</p>
</li>
<li>
<p>Ask for a payment account (json) form, e.g.,</p>
<p><code>$ getpaymentacctform  japan_bank</code>  (a paymentMethodId)    -- returns a json file with fields specific to the payment method</p>
</li>
<li>
<p>Edit the returned json file, i.e., <code>japan_bank_form.json</code> with the user's file editor.</p>
</li>
<li>
<p>Submit the payment account json form via the CLI.</p>
<p><code>$ createpaymentacct  japan_bank_form.json</code></p>
</li>
</ol>
<p>The PR adds the new classes needed to generate a payment account json form for a given <code>paymentMethodId</code> (serialize only the necessary fields in a <code>PaymentAccount</code> subclass to json file), and de-serialize an edited json form into a <code>PaymentAccount</code> instance.</p>
<p>Changes include</p>
<ul>
<li>
<p>A new <code>isCountryBasedPaymentAccount</code> method in the abstract  <code>PaymentAccount</code>, to help in serialization / de-serialization.</p>
</li>
<li>
<p>A new <code>ReflectionUtils</code> class to :common util pkg.</p>
</li>
<li>
<p>A new gson <code>PaymentAccountTypeAdapter</code> in core.api.model, for doing the <code>PaymentAccount</code> serialization and de-serialization<br>
work.</p>
</li>
<li>
<p>A new <code>PaymentAccountForm</code> class in core.api.model, to be used  by the API's server, for creating new fiat accounts from json   forms.</p>
</li>
<li>
<p>A new <code>PaymentAccountFormTest</code> to prove this scheme works.</p>
</li>
</ul>
<p>This new <code>PaymentAccount</code> serialization / de-serialization scheme is  not exposed in the API yet, nor are de-serialized <code>PaymentAccount</code> instances persisted.  The only change to existing code is the new <code>boolean isCountryBasedPaymentAccount()</code> method added to abstract <code>PaymentAccount</code>.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/4752'>https://github.com/bisq-network/bisq/pull/4752</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Add is instanceof CountryBasedPaymentAccount check to PaymentAccount</li>
  <li>Add ReflectionUtils to :common.util pkg</li>
  <li>Add gson type adapter for PaymentAccount serialization & de-serialization</li>
  <li>Add PaymentAccountForm for writing empty and submitting filled fiat acct json forms</li>
  <li>Test PaymentAccount / Json serialization and de-serialization</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4752/files#diff-58fc3071843d62f9baf1575a4c078587860ca58fb8f0854c5389dc5779584317">common/src/main/java/bisq/common/util/ReflectionUtils.java</a>
    (108)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4752/files#diff-0ee6d746cd6c9f47730564789acdbc817a021fae26cf38fc1493c03e61ac0270">core/src/main/java/bisq/core/api/model/PaymentAccountForm.java</a>
    (135)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4752/files#diff-51eee6356fda3d54c9fdf17f0d40df2bd8fbaec835183ef02f45416e6ff37d75">core/src/main/java/bisq/core/api/model/PaymentAccountTypeAdapter.java</a>
    (323)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4752/files#diff-189dabf054a26f4cd086890f538252d6c47a246491d7d95e730ce6a0e640d786">core/src/main/java/bisq/core/payment/PaymentAccount.java</a>
    (4)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4752/files#diff-b9699258b11d6ade31c99bbdd5b414b1a2752bc0400165461cc00a4c0b51701b">core/src/test/java/bisq/core/api/model/PaymentAccountFormTest.java</a>
    (411)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/4752.patch'>https://github.com/bisq-network/bisq/pull/4752.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/4752.diff'>https://github.com/bisq-network/bisq/pull/4752.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/4752">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNQZFAH6SHGXW4Y5PPDSOLITNANCNFSM4TLTCWGQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNVC7YLTNJ7HREKGTT3SOLITNA5CNFSM4TLTCWG2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4K7PDVKA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/4752",
"url": "https://github.com/bisq-network/bisq/pull/4752",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>