-
Notifications
You must be signed in to change notification settings - Fork 32
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
billingAccountIdfield to theResourceBookingmodel. We should be able to set/update/get it using ResourceBooking endpoints.billingAccountIdis an optional fields typebigint. - Add
billingAccountIdfiled to theWorkPeriodPaymentmodel. We should NOT be able to set/update it using any endpoint.- when we are creating a new payment
WorkPeriodPaymentrecord, we also processing an actual payment using the methodcreatePaymenthttps://github.com/topcoder-platform/taas-apis/blob/dev/src/services/WorkPeriodPaymentService.js#L99-L105. - before creating a payment get the
billingAccountIdform 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
billingAccountIdto thecreatePaymentmethod, 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
workPeriodPaymentrecords, set the billing account id which we used toworkPeriodPayment.billingAccountIdfor 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.