Hi all, I'm trying to create my own mock settlement rail but is facing an issue and I've been trying to resolve it for the past week, still I don't know what went wrong. I'm not sure if this issue is the same as the one raised by TAC911 here.
This is the the command I'm running on the shell start UpdateSettlementMethod linearId: 389b634d-2d4f-4f00-84e9-c903b0454e4d, settlementMethod: { accountToPay: dummyAccount001, settlementOracle: Oracle, _type: com.r3.corda.finance.dummy.types.DummySettlement } and this is the errors:
Tue Jun 11 13:39:28 SGT 2019>>> start UpdateSettlementMethod linearId: 389b634d-2d4f-4f00-84e9-c903b0454e4d, settlementMethod: { accountToPay: dummyAccount001, settlementOracle: Oracle, _type: com.r3.corda.finance.dummy.types.DummySettlement }
No matching constructor found:
- [net.corda.core.contracts.UniqueIdentifier, com.r3.corda.finance.obligation.types.SettlementMethod]: Could not parse as a command: Could not resolve type id 'com.r3.corda.finance.dummy.types.DummySettlement' as a subtype of [simple type, class com.r3.corda.finance.obligation.types.SettlementMethod]: no such class found
at [Source: UNKNOWN; line: -1, column: -1]
The followings are the classes I have created in my mock settlement module:
DummyPayment:
package com.r3.corda.finance.dummy.types
import com.r3.corda.finance.obligation.types.Money
import com.r3.corda.finance.obligation.types.Payment
import com.r3.corda.finance.obligation.types.PaymentReference
import com.r3.corda.finance.obligation.types.PaymentStatus
import net.corda.core.contracts.Amount
data class DummyPayment(
override val paymentReference: PaymentReference,
override val amount: Amount,
override var status: PaymentStatus = PaymentStatus.SENT
) : Payment {
override fun toString(): String {
return "Amount: $amount, Dummy Reference: $paymentReference, Status: $status"
}
}
DummySettlement:
package com.r3.corda.finance.dummy.types
import com.r3.corda.finance.obligation.types.OffLedgerPayment
import com.r3.corda.finance.dummy.flows.MakeDummyPayment
import net.corda.core.identity.Party
data class DummySettlement(
override val accountToPay: String,
override val settlementOracle: Party,
override val paymentFlow: Class> = MakeDummyPayment::class.java
) : OffLedgerPayment> {
override fun toString(): String {
return "Pay to $accountToPay and use $settlementOracle as settlement Oracle."
}
}
MakeDummyPayment:
package com.r3.corda.finance.dummy.flows
import co.paralleluniverse.fibers.Suspendable
import com.r3.corda.finance.dummy.types.DummyPayment
import com.r3.corda.finance.dummy.types.DummySettlement
import com.r3.corda.finance.obligation.client.flows.MakeOffLedgerPayment
import com.r3.corda.finance.obligation.states.Obligation
import com.r3.corda.finance.obligation.types.*
import net.corda.core.contracts.Amount
import net.corda.core.contracts.StateAndRef
import net.corda.core.flows.FlowException
import net.corda.core.utilities.ProgressTracker
import com.r3.corda.finance.dummy.types.*
class MakeDummyPayment(
amount: Amount,
obligationStateAndRef: StateAndRef>,
settlementMethod: OffLedgerPayment<*>,
progressTracker: ProgressTracker
) : MakeOffLedgerPayment(amount, obligationStateAndRef, settlementMethod, progressTracker) {
@Suspendable
override fun setup() {
}
override fun checkBalance(requiredAmount: Amount<*>) {
}
@Suspendable
override fun makePayment(obligation: Obligation<*>, amount: Amount): DummyPayment {
if (amount.token !is FiatCurrency)
throw FlowException("Please only pay in FiatCurrency for now.")
if (obligation.settlementMethod == null)
throw FlowException("Please update the SettlementMethod to DummySettlement for now.")
if (obligation.settlementMethod !is DummySettlement)
throw FlowException("Please use only DummySettlement for now.")
return DummyPayment((obligation.payments.size + 1).toString(), amount as Amount, PaymentStatus.SENT) as DummyPayment
}
}
The command can be ran if it's being settled in XRP. I'm not sure if there is any relevance of the type of accountToPay (String type, in DummySettlement class) which might affect some other dependencies?
Any help or insights would be much appreciated.
Hi all, I'm trying to create my own mock settlement rail but is facing an issue and I've been trying to resolve it for the past week, still I don't know what went wrong. I'm not sure if this issue is the same as the one raised by TAC911 here.
This is the the command I'm running on the shell
start UpdateSettlementMethod linearId: 389b634d-2d4f-4f00-84e9-c903b0454e4d, settlementMethod: { accountToPay: dummyAccount001, settlementOracle: Oracle, _type: com.r3.corda.finance.dummy.types.DummySettlement }
and this is the errors:The followings are the classes I have created in my mock settlement module: DummyPayment:
DummySettlement: MakeDummyPayment: The command can be ran if it's being settled in XRP. I'm not sure if there is any relevance of the type of accountToPay (String type, in DummySettlement class) which might affect some other dependencies? Any help or insights would be much appreciated.