Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: trade desk conversions v1 proxy #3067

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/rakuten/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const constructLineItems = (properties) => {
}

if (product.price) {
return product.quantity * product.price * 100;
return product.quantity * product.price * 100;
}
return product.amount * 100;
});
Expand Down
2 changes: 1 addition & 1 deletion src/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@
"SPRIG"
],
"supportSourceTransformV1": true,
"supportTransformerProxyV1": false
"supportTransformerProxyV1": true
}
34 changes: 16 additions & 18 deletions src/util/error-extractor/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
/* eslint-disable max-classes-per-file */
import { MessageDetails, StatusCode, Stat } from "./types";
import { MessageDetails, StatusCode, Stat } from './types';

export class ErrorDetailsExtractor {
status: StatusCode;

messageDetails: MessageDetails;

stat : Stat
stat: Stat;

constructor (builder: ErrorDetailsExtractorBuilder) {
constructor(builder: ErrorDetailsExtractorBuilder) {
this.status = builder.getStatus();
this.messageDetails = builder.getMessageDetails();
this.stat = builder.getStat();
}

}

export class ErrorDetailsExtractorBuilder {
Expand All @@ -22,58 +21,59 @@ export class ErrorDetailsExtractorBuilder {
messageDetails: MessageDetails;

stat: Stat;

constructor() {
this.status = 0;
this.messageDetails = {};
this.stat = {};
}

setStatus(status: number): ErrorDetailsExtractorBuilder {
this.status = status;
return this;
}

setStat(stat: Record<string, string>): ErrorDetailsExtractorBuilder {
this.stat = stat
this.stat = stat;
return this;
}

/**
* This means we need to set a message from a specific field that we see from the destination's response
*
*
* @param {string} fieldPath -- Path of the field which should be set as "error message"
* @returns
* @returns
*/
setMessageField(fieldPath: string): ErrorDetailsExtractorBuilder {
if (this.messageDetails?.message) {
// This check basically ensures that "setMessage" was not already before
return this;
}
this.messageDetails = {
field: fieldPath
}
field: fieldPath,
};
return this;
}

/**
* This means we need to set the message provided
*
*
* @param {string} msg - error message
* @returns
* @returns
*/
setMessage(msg: string): ErrorDetailsExtractorBuilder {
if (this.messageDetails?.field) {
// This check basically ensures that "setMessageField" was not already called before
return this;
}
this.messageDetails = {
message: msg
}
message: msg,
};
return this;
}

build(): ErrorDetailsExtractor {
return new ErrorDetailsExtractor(this)
return new ErrorDetailsExtractor(this);
}

getStatus(): number {
Expand All @@ -83,10 +83,8 @@ export class ErrorDetailsExtractorBuilder {
getStat(): Record<string, string> {
return this.stat;
}

getMessageDetails(): Record<string, string> {
return this.messageDetails;
}
}


2 changes: 1 addition & 1 deletion src/util/error-extractor/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export type MessageDetails = Record<string, string>;
export type StatusCode = number;
export type Stat = Record<string, string>
export type Stat = Record<string, string>;
2 changes: 1 addition & 1 deletion src/v0/util/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ERROR_TYPES = {
OAUTH_SECRET: 'oAuthSecret',
UNSUPPORTED: 'unsupported',
REDIS: 'redis',
FILTERED: 'filtered'
FILTERED: 'filtered',
};

const METADATA = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,14 +512,15 @@ export const networkCallsData = [
httpRes: {
data: {
error: {
message: 'Error validating access token: Session has expired on Tuesday, 01-Aug-23 10:12:14 PDT. The current time is Sunday, 28-Jan-24 16:01:17 PST.',
message:
'Error validating access token: Session has expired on Tuesday, 01-Aug-23 10:12:14 PDT. The current time is Sunday, 28-Jan-24 16:01:17 PST.',
type: 'OAuthException',
code: 190,
error_subcode: 463,
fbtrace_id: 'A3b8C6PpI-kdIOwPwV4PANi'
fbtrace_id: 'A3b8C6PpI-kdIOwPwV4PANi',
},
},
status: 400,
},
}
},
];
Loading
Loading