public static PriceEntity Multiply(PriceEntity p, decimal multiplier) { if (!p.IsEligible()) { return(CALL_PRICING); } return(new PriceEntity() { value = p.value * multiplier, currency = p.currency }); }
public static PriceEntity Divide(PriceEntity p, int divisor) { if (!p.IsEligible()) { return(CALL_PRICING); } return(new PriceEntity() { value = p.value / divisor, currency = p.currency }); }
public static PriceEntity Add(PriceEntity p, PriceEntity add) { if (!p.IsEligible() && !add.IsEligible()) { return(CALL_PRICING); } if (p.currency != add.currency) { // currency mismatch return(p); } return(new PriceEntity() { value = p.value + add.value, currency = p.currency }); }
public static PriceEntity Subtract(PriceEntity p, PriceEntity sub) { if (!p.IsEligible() && !sub.IsEligible()) { return(CALL_PRICING); } if (p.currency != sub.currency) { // currency mismatch return(p); } return(new PriceEntity() { value = p.value - sub.value, currency = p.currency }); }