示例#1
0
long MTRecord::GetInitialPaymentAmount()
{
    if (!IsPaymentPlan())
        return 0;

    OTPaymentPlan  thePlan;
    const OTString strPlan(GetContents().c_str());

    if (thePlan.LoadContractFromString(strPlan) &&
        thePlan.HasInitialPayment())
        return thePlan.GetInitialPaymentAmount();
    return 0;
}
示例#2
0
bool OTPayment::SetTempValuesFromPaymentPlan(const OTPaymentPlan & theInput)
{
    if (OTPayment::PAYMENT_PLAN == m_Type)
    {
        m_bAreTempValuesSet = true;
        m_bHasRecipient     = true;
        m_bHasRemitter      = false;
        // -------------------------
        m_lAmount           = theInput.GetInitialPaymentAmount();  // There're also regular payments of GetPaymentPlanAmount(). Can't fit 'em all.        
        m_lTransactionNum   = theInput.GetTransactionNum();                
        // -------------------------
        // const OTString &  OTPaymentPlan::GetConsideration() const 
        //                  { return m_strConsideration; }
        if (theInput.GetConsideration().Exists())
            m_strMemo.Set(theInput.GetConsideration());
        else
            m_strMemo.Release();
        // -------------------------
        m_AssetTypeID      = theInput.GetAssetID();     
        m_ServerID         = theInput.GetServerID();     
        // ----------------------------
        m_SenderUserID     = theInput.GetSenderUserID();    
        m_SenderAcctID     = theInput.GetSenderAcctID();    
        // ----------------------------        
        m_RecipientUserID  = theInput.GetRecipientUserID();
        m_RecipientAcctID  = theInput.GetRecipientAcctID();
        // ----------------------------
        m_RemitterUserID.Release();
        // ----------------------------
        m_VALID_FROM    = theInput.GetValidFrom();
        m_VALID_TO      = theInput.GetValidTo();
        // --------------------------------
        return true;
    }
    else
        OTLog::Error("OTPayment::SetTempValuesFromPaymentPlan: Error: Wrong type. (Returning false.)\n");

    return false;    
}