-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added new migration for connected_argyle_accounts * added ConnectedArgyleAccount model * added ability to query payroll-data from argyle for connected account. added webhook logic to persist connected accounts into the database * uncommented signature check * Passing test for Argyle payroll * fixed test assertions and stubs * updated test descriptions and made them look pretty * updates per PR feedback * moved test setup logic to before block
- Loading branch information
George Byers
authored
May 7, 2024
1 parent
e1120f3
commit 1550724
Showing
15 changed files
with
180 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ConnectedArgyleAccount < ApplicationRecord | ||
validates :user_id, presence: true | ||
validates :account_id, presence: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Btn0OVg1L730VpNEbQ+H15cFKg1y3q/z6IwIaDc9c4iExboCtzTUsYU/NO4sXKVZ0m0ShItWOKR4IxwCqw7GrIRKckilMnNhJKKMZJ9clj6CieYC9efIb8WeUe3c11AA--KLu1KB+ynGorNBrB--+jEPdTuPzExEtrlSeJzR9g== | ||
pWx+QNd/gK0RyL9jUoME8AVCKEPpGVXDzQrBov/o5dQNXhb3AF8ZLVEFErUXesZPt+ZFjO0kOWfgwHALtRtwkWHZpt6mF7odr9fG4W6pQkorMPHdwaVVJoSTCHbQ5a357qF0EcuDXXmHCGqqr0sG0ly+8NNLSmOM4zdV0Rq1Rwi0hnQjo4RPSZ6hIiYTR3VqwAxbAaWqLwC01Q/wbt/bxNHKq0f6k/Q9yQQ=--MpaWHAhpoYnJd8WO--pz1XxYcKma6dhIuVugJv8w== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
db/migrate/20240502195250_create_connected_argyle_accounts.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CreateConnectedArgyleAccounts < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :connected_argyle_accounts do |t| | ||
t.uuid :user_id, null: false | ||
t.uuid :account_id, null: false | ||
t.timestamps null: false | ||
t.index [ :user_id, :account_id ], unique: true | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
def account_connected_webhook_stub | ||
'{ | ||
"event": "accounts.connected", | ||
"name": "Account Connected", | ||
"data": { | ||
"account": "018f3fb8-47b7-7a9f-b95a-530117e8522e", | ||
"user": "018f110a-39c1-3a5f-826f-a004eb7ed0b5", | ||
"resource": { | ||
"id": "018f3fb8-47b7-7a9f-b95a-530117e8522e", | ||
"user": "018f110a-39c1-3a5f-826f-a004eb7ed0b5", | ||
"employers": [], | ||
"item": "item_000012375", | ||
"source": "argyle_sandbox", | ||
"created_at": "2024-05-03T18:29:52.780604Z", | ||
"updated_at": "2024-05-03T18:30:09.761659Z", | ||
"connection": { | ||
"status": "connected", | ||
"error_code": null, | ||
"error_message": null, | ||
"updated_at": "2024-05-03T18:30:09.137853Z" | ||
}, | ||
"direct_deposit_switch": { | ||
"status": "idle", | ||
"error_code": null, | ||
"error_message": null, | ||
"updated_at": "2024-05-03T18:29:53.219572Z" | ||
}, | ||
"availability": { | ||
"gigs": null, | ||
"paystubs": null, | ||
"payroll_documents": null, | ||
"identities": null, | ||
"ratings": null, | ||
"vehicles": null, | ||
"deposit_destinations": null, | ||
"user_forms": null | ||
}, | ||
"ongoing_refresh": { | ||
"status": "idle" | ||
} | ||
} | ||
} | ||
}' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
def payroll_documents_response_stub | ||
'{ | ||
"data": [ | ||
{ | ||
"id": "018f110a-39c1-3a5f-826f-a004eb7ed0b5", | ||
"account": "018f3fb8-47b7-7a9f-b95a-530117e8522e", | ||
"document_number": null, | ||
"available_date": "2020-05-13T17:25:59Z", | ||
"expiration_date": null, | ||
"employer": "Whole Goods", | ||
"document_type": "payout-statement", | ||
"document_type_description": null, | ||
"file_url": "api.argyle.com/v2/payroll-documents/{id}/file", | ||
"created_at": "2023-03-13T17:27:01.501Z", | ||
"updated_at": "2023-03-13T17:27:01.501Z", | ||
"ocr_data": {}, | ||
"metadata": {} | ||
}, | ||
{ | ||
"id": "018f110a-39c1-3a5f-826f-a004eb7ed0b5", | ||
"account": "018f3fb8-47b7-7a9f-b95a-530117e8522e", | ||
"document_number": "ced46eb3-7586-3cd7-2418-8eb9482bc3ec", | ||
"available_date": "2019-03-14T17:46:25Z", | ||
"expiration_date": "2027-03-12T17:46:25Z", | ||
"employer": "GigAndGo", | ||
"document_type": "drivers-licence", | ||
"document_type_description": "Driver\'s license", | ||
"file_url": "api.argyle.com/v2/payroll-documents/{id}/file", | ||
"created_at": "2023-03-13T17:46:28.240Z", | ||
"updated_at": "2023-03-13T17:46:28.240Z", | ||
"ocr_data": {}, | ||
"metadata": {} | ||
} | ||
] | ||
}' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def webhook_x_argyle_signature | ||
'X-Argyle-Signature: cbc0045ca9ba037086d7396966516349bc7a0c9f48b0eaf1e2d0a5002d77dc7202b48e88bfb0ad3a8973e56998a6ad519f98801cee9527be4297f53223d3f8bf' | ||
end |