//------------------------------------------------------------------------- public Trade parseTrade(FpmlDocument document, XmlElement tradeEl) { // supported elements: // 'payment/payerPartyReference' // 'payment/receiverPartyReference' // 'payment/paymentAmount' // 'payment/paymentDate?' // ignored elements: // 'payment/payerAccountReference?' // 'payment/receiverAccountReference?' // 'payment/paymentType?' // 'payment/settlementInformation?' // 'payment/discountFactor?' // 'payment/presentValueAmount?' TradeInfoBuilder tradeInfoBuilder = document.parseTradeInfo(tradeEl); XmlElement bulletEl = tradeEl.getChild("bulletPayment"); XmlElement paymentEl = bulletEl.getChild("payment"); BulletPayment.Builder bulletBuilder = BulletPayment.builder(); // pay/receive and counterparty bulletBuilder.payReceive(document.parsePayerReceiver(paymentEl, tradeInfoBuilder)); // payment date bulletBuilder.date(document.parseAdjustableDate(paymentEl.getChild("paymentDate"))); // amount bulletBuilder.value(document.parseCurrencyAmount(paymentEl.getChild("paymentAmount"))); return(BulletPaymentTrade.builder().info(tradeInfoBuilder.build()).product(bulletBuilder.build()).build()); }
//------------------------------------------------------------------------- public virtual void coverage() { ResolvedTradeParameterMetadata test1 = ResolvedTradeParameterMetadata.of(TRADE, "Label"); coverImmutableBean(test1); ResolvedTrade trade = ResolvedBulletPaymentTrade.of(TradeInfo.empty(), BulletPayment.builder().date(AdjustableDate.of(LocalDate.of(2017, 3, 3))).value(CurrencyAmount.of(Currency.USD, 100d)).payReceive(PayReceive.PAY).build().resolve(REF_DATA)); ResolvedTradeParameterMetadata test2 = ResolvedTradeParameterMetadata.builder().trade(trade).label("Label2").build(); coverBeanEquals(test1, test2); }