Skip to content

Commit

Permalink
2.5.10 oauth webhook + ignore proposed
Browse files Browse the repository at this point in the history
  • Loading branch information
pauljonescodes committed Nov 16, 2023
1 parent 53b1215 commit 54abe80
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/moa-square/controllers/orders.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ export class OrdersController {
lineItems?: boolean,
@Query('location', new DefaultValuePipe(false), ParseBoolPipe)
location?: boolean,

@Query('idempotencyKey') idempotencyKey?: string,
) {
const { variations } = body;
Expand Down
10 changes: 4 additions & 6 deletions src/moa-square/services/merchants.square.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,12 @@ export class MerchantsSquareService {
}

@OnEvent('square.oauth.authorization.revoked')
handleOauthAuthorizationRevoked(
async handleOauthAuthorizationRevoked(
payload: SquareOauthAuthorizationRevokedEventPayload,
) {
this.logger.debug(
`Handling SquareOauthAuthorizationRevokedEventPayload ${JSON.stringify(
payload,
)}}`,
);
if (payload.merchant_id) {
await this.deleteOauth({ merchantId: payload.merchant_id });
}
}

/*
Expand Down
4 changes: 3 additions & 1 deletion src/moa-square/services/orders.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ export class OrdersService extends EntityRepositoryService<OrderEntity> {

updatedOrder.squareId = squareCreateOrderResult.id;
updatedOrder.closedDate = new Date();
updatedOrder.squareFulfillmentStatus = FulfillmentStatusEnum.proposed;
updatedOrder.pickupDate = new Date(pickupOrAsapDate);
updatedOrder.customerId = customerMoaId;
updatedOrder.totalMoneyAmount = Number(
Expand Down Expand Up @@ -857,7 +858,8 @@ export class OrdersService extends EntityRepositoryService<OrderEntity> {
if (
newFulfillmentStatus &&
isValidFulfillmentStatus(newFulfillmentStatus) &&
newFulfillmentStatus != oldFulfillmentStatus
newFulfillmentStatus != oldFulfillmentStatus &&
newFulfillmentStatus != FulfillmentStatusEnum.proposed
) {
order.squareFulfillmentStatus = newFulfillmentStatus;
await this.save(order);
Expand Down

0 comments on commit 54abe80

Please sign in to comment.