Skip to content

Commit

Permalink
Activity log fixes v2 (#2040)
Browse files Browse the repository at this point in the history
* Fixes for payment, and activity log. (#2038)

* Fixes activity log payment (#2039)

* Fixes for payment, and activity log.

* Fix wording.
  • Loading branch information
seeker25 authored Jul 18, 2022
1 parent d08ed17 commit d8c8560
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions auth-api/src/auth_api/services/activity_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def fetch_activity_logs(org_id: int, **kwargs): # pylint: disable=too-many-loca
activity_log: ActivityLogModel = result[0]
log_dict = ActivityLogSchema(exclude=('actor_id',)).dump(activity_log)

if user := result[1]:
actor = ActivityLog._mask_user_name(is_staff_access, user)
log_dict['actor'] = actor
user = result[1]
actor = ActivityLog._mask_user_name(is_staff_access, user)
log_dict['actor'] = actor
log_dict['action'] = ActivityLog._build_string(activity_log)
logs['activity_logs'].append(log_dict)

Expand Down Expand Up @@ -208,6 +208,8 @@ def _removing_products_and_services(activity: ActivityLogModel) -> str:

@ staticmethod
def _mask_user_name(is_staff_access, user):
if user is None:
return 'Service Account'
is_actor_a_staff = user.type == Role.STAFF.name
if not is_staff_access and is_actor_a_staff:
actor = 'BC Registry Staff'
Expand Down
4 changes: 2 additions & 2 deletions auth-web/src/components/pay/PayWithCreditCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<h2 class="mb-2">Balance Due: <span class="ml-2">${{totalBalanceDue.toFixed(2)}}</span></h2>
<template>
<p class="mb-1" v-if="showPayWithOnlyCC">
<strong>Credit card will be the only payment option for this transaction</strong>.<br />
Online banking payment option is not available.
<strong>Credit card is the only payment option for this transaction</strong>.<br />
Online Banking is not available for this transaction.
</p>
<p class="mb-1" v-if="partialCredit">
You can't <strong>use your account credit</strong> with credit card payment.<br />
Expand Down
5 changes: 4 additions & 1 deletion auth-web/src/services/payment.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ export default class PaymentService {
return axios.get(`${ConfigHelper.getPayAPIURL()}/payment-requests/${invoiceId}`, { headers: headers })
}

static updateInvoicePaymentMethodAsCreditCard (paymentId: string): AxiosPromise<any> {
static updateInvoicePaymentMethodAsCreditCard (paymentId: string, accountId: number): AxiosPromise<any> {
const headers = accountId ? { 'Account-Id': accountId } : {}
const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${paymentId}`
return axios.patch(url, {
paymentInfo: {
methodOfPayment: PaymentTypes.CREDIT_CARD
}
}, {
headers: headers
}
)
}
Expand Down
4 changes: 2 additions & 2 deletions auth-web/src/store/modules/org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,8 @@ export default class OrgModule extends VuexModule {
}

@Action({ rawError: true })
public async updateInvoicePaymentMethodAsCreditCard (paymentId: string) {
const response = await PaymentService.updateInvoicePaymentMethodAsCreditCard(paymentId)
public async updateInvoicePaymentMethodAsCreditCard (invoicePayload) {
const response = await PaymentService.updateInvoicePaymentMethodAsCreditCard(invoicePayload.paymentId, invoicePayload.accountId)
return response?.data || {}
}

Expand Down
5 changes: 3 additions & 2 deletions auth-web/src/views/pay/PaymentView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class PaymentView extends Vue {
@Prop({ default: '' }) paymentId: string
@Prop({ default: '' }) redirectUrl: string
private readonly createTransaction!: (transactionData) => any
private readonly updateInvoicePaymentMethodAsCreditCard!: (paymentId: string) => any
private readonly updateInvoicePaymentMethodAsCreditCard!: (invoicePayload) => any
private readonly downloadOBInvoice!: (paymentId: string) => any
private readonly getOrgPayments!: (orgId: number) => OrgPaymentDetails
private readonly getInvoice!: (invoicePayload) => Invoice
Expand Down Expand Up @@ -162,7 +162,8 @@ export default class PaymentView extends Vue {
// patch the transaction
// redirect for payment
try {
await this.updateInvoicePaymentMethodAsCreditCard(this.paymentId)
const accountSettings = this.getAccountFromSession()
await this.updateInvoicePaymentMethodAsCreditCard({ paymentId: this.paymentId, accountId: accountSettings?.id })
await this.doCreateTransaction()
} catch (error) {
this.doHandleError(error)
Expand Down

0 comments on commit d8c8560

Please sign in to comment.