CreateReceipt

Attributes

ObjectId

See ‘object-id’ in object-type: receipt.

Optional

PaymentType
See ‘payment-type’ in object-type: receipt.
BondId
See ‘bond-id’ in object-type: receipt.
PayeeId
See ‘payee-id’ in object-type: receipt.
CouponDate

See ‘coupon-date’ in object-type: receipt.

Optional

Required if PaymentType is Coupon

JSON Examples

Example 1:

{
    "UpdateType": "CreateReceipt",
    "PaymentType": "Coupon",
    "BondId": "OBJECT_ID",
    "PayeeId": "OBJECT_ID",
    "CouponDate": "10/03/2015"
}

check_valid()

The following checks are performed:

  • Check that all required attributes have been provided.
  • Check that all provided unique attributes do not exist in the store.
  • Check that PaymentType is either Coupon or Redemption
  • Check that the BondId reference a valid bond
  • Check that the PayeeId reference an organization and that it has holdings in the bond and USD Currency holding.
  • Check that the Payer has enough funds to pay and that if it is a Redemption they have the bond holding.
  • Check the date to see if it valid for the PaymentType. For Coupon, check that the date falls on a valid date for the coupon frequency of the bond. For Redemption, check that the date is after the bonds maturity date.

apply()

Create a new object in the store with object-type of ‘receipt’. Also add the ‘receipt’ to the Payee’s receipt list. Exchange the currency amount required and, if it is a Redemption, return bonds to the issuer.

Increment the ref-count of the corresponding bond.