@riocrypto/common-server 1.0.1763 → 1.0.1765

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,15 @@ declare class CoincoverClient {
24
24
  postalCode: string;
25
25
  country: string;
26
26
  }, contactPersonName: string, contactPersonEmail: string): Promise<void>;
27
+ patchIndividualUser(user: User): Promise<void>;
28
+ patchBusinessUser(user: User, address: {
29
+ street1: string;
30
+ street2?: string;
31
+ city: string;
32
+ state: string;
33
+ postalCode: string;
34
+ country: string;
35
+ }, contactPersonName: string, contactPersonEmail: string): Promise<void>;
27
36
  private formatDate;
28
37
  private formatAddress;
29
38
  private getResidenceCountry;
@@ -111,6 +111,40 @@ class CoincoverClient {
111
111
  return data;
112
112
  });
113
113
  }
114
+ patchIndividualUser(user) {
115
+ var _a, _b, _c;
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const { data } = yield axios_with_logging_1.default.patch(`${this.baseUrl}/user/${user.id}`, {
118
+ firstName: (_a = user.individualData) === null || _a === void 0 ? void 0 : _a.firstName,
119
+ lastName: (_b = user.individualData) === null || _b === void 0 ? void 0 : _b.lastName,
120
+ dob: ((_c = user.individualData) === null || _c === void 0 ? void 0 : _c.birthday)
121
+ ? this.formatDate(user.individualData.birthday)
122
+ : undefined,
123
+ residenceCountry: this.getResidenceCountry(user),
124
+ }, {
125
+ headers: {
126
+ Authorization: `Bearer ${this.apiKey}`,
127
+ },
128
+ });
129
+ return data;
130
+ });
131
+ }
132
+ patchBusinessUser(user, address, contactPersonName, contactPersonEmail) {
133
+ var _a;
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ const { data } = yield axios_with_logging_1.default.patch(`${this.baseUrl}/business/${user.id}`, {
136
+ name: (_a = user.businessData) === null || _a === void 0 ? void 0 : _a.businessName,
137
+ address: this.formatAddress(address.street1, address.city, address.state, address.postalCode, address.country, address.street2),
138
+ contactPersonName,
139
+ contactPersonEmail,
140
+ }, {
141
+ headers: {
142
+ Authorization: `Bearer ${this.apiKey}`,
143
+ },
144
+ });
145
+ return data;
146
+ });
147
+ }
114
148
  }
115
149
  const buildCoincoverClient = () => __awaiter(void 0, void 0, void 0, function* () {
116
150
  // Retrieve secrets asynchronously
@@ -107,6 +107,7 @@ interface UserAttrs {
107
107
  };
108
108
  };
109
109
  };
110
+ attioRecordId?: string;
110
111
  }
111
112
  interface UserModel extends Model<UserDoc> {
112
113
  build(attrs: UserAttrs): UserDoc;
@@ -115,6 +116,7 @@ interface UserDoc extends Document {
115
116
  _id: string;
116
117
  createdAt: Date;
117
118
  authIds?: string[];
119
+ attioRecordId?: string;
118
120
  registeredWithCoincover?: boolean;
119
121
  individualData?: {
120
122
  firstName: string;
@@ -41,6 +41,9 @@ const buildUser = (mongoose) => {
41
41
  type: Boolean,
42
42
  required: true,
43
43
  },
44
+ attioRecordId: {
45
+ type: String,
46
+ },
44
47
  attributes: [
45
48
  {
46
49
  type: String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1763",
3
+ "version": "1.0.1765",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",