Closed
Description
At the moment we are processing all the payments using the default billing account. We would like to use a billing account which we would set for Resource Booking.
- Add
billingAccountId
field to theResourceBooking
model. We should be able to set/update/get it using ResourceBooking endpoints.billingAccountId
is an optional fields typebigint
. - Add
billingAccountId
filed to theWorkPeriodPayment
model. We should NOT be able to set/update it using any endpoint.- when we are creating a new payment
WorkPeriodPayment
record, we also processing an actual payment using the methodcreatePayment
https://github.com/topcoder-platform/taas-apis/blob/dev/src/services/WorkPeriodPaymentService.js#L99-L105. - before creating a payment get the
billingAccountId
form the corresponding ResourceBooking - if Resource Booking doesn't have billing account set, throw error
Billing account is not assigned to the resource booking.
We should not be able to create WorkPeriodPayment and process the payment without billing account set for the Resource Booking. - if the billing account is there, then:
- pass
billingAccountId
to thecreatePayment
method, and make sure that is pass it to the challenge it creates here https://github.com/topcoder-platform/taas-apis/blob/dev/src/services/PaymentService.js#L83
- pass
- when creating
workPeriodPayment
records, set the billing account id which we used toworkPeriodPayment.billingAccountId
for to track the history
- when we are creating a new payment
- As we update model make sure that we update all documentation and utils as per https://github.com/topcoder-platform/taas-apis#documentation-and-utils
Unit tests
Create unit test which would check that without billing account set for resource booking we get error. And if the billing account is set then work period payment is created correctly with the billing account set.