pfs 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/pfs/api/accounts_service.rb +46 -0
- data/lib/pfs/client.rb +4 -0
- data/lib/pfs/resources/accounts/account.rb +20 -0
- data/lib/pfs/resources/accounts/account_holder.rb +61 -0
- data/lib/pfs/resources/accounts/account_info.rb +38 -0
- data/lib/pfs/resources/accounts/issued_account.rb +33 -0
- data/lib/pfs/resources/accounts/status.rb +20 -0
- data/lib/pfs/resources/base.rb +13 -0
- data/lib/pfs/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 043d37e569940a1f1cf3be1d690f4c4f84e3c37924171d3c66f5c314994e55fb
|
4
|
+
data.tar.gz: 5a00857236ba3a0473d7aed84f68ac0fa82147a35a41de7d92b1bbbb234d2eb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7932aea62d9494471bf0922b45f1aa44b80e38f517f430328d556c8899e6bbd5175ac286ce07fe8472f7e0ab4b92bb04e8cbfcae3c06280d79b751049eda285
|
7
|
+
data.tar.gz: 70342f1bfafa3b29c12b0aac381f4411c26d5c95dcdb0d19c09ddbcf8ed21d1026561f45e8d21af60c5a841721b69f68db3f93db73ef41410e7ad5bcf0ad9ce2
|
@@ -8,6 +8,52 @@ module PFS
|
|
8
8
|
Resources::Accounts::Balance.new(response, response.body[:data])
|
9
9
|
end
|
10
10
|
|
11
|
+
def issue(bin:, dc:, style: ,incorporation_date:, company_name:, first_name:, last_name:, address:, postal_code: , city:, state:, country:, user_defined1: nil, user_defined2: nil, user_defined3: nil, user_defined4: nil)
|
12
|
+
attributes = {
|
13
|
+
bin: bin,
|
14
|
+
distributorcode: dc,
|
15
|
+
cardstyle: style,
|
16
|
+
companyname: company_name,
|
17
|
+
firstname: first_name,
|
18
|
+
lastname: last_name,
|
19
|
+
dateofbirth: incorporation_date,
|
20
|
+
address1: address,
|
21
|
+
city: city,
|
22
|
+
county: state,
|
23
|
+
zipcode: postal_code,
|
24
|
+
countrycode: country,
|
25
|
+
}
|
26
|
+
attributes[:userdefined1] = user_defined1 if user_defined1
|
27
|
+
attributes[:userdefined2] = user_defined2 if user_defined2
|
28
|
+
attributes[:userdefined3] = user_defined3 if user_defined3
|
29
|
+
attributes[:userdefined4] = user_defined4 if user_defined4
|
30
|
+
|
31
|
+
response = client.post("/Account", attributes)
|
32
|
+
Resources::Accounts::IssuedAccount.new(response, response.body[:data])
|
33
|
+
end
|
34
|
+
|
35
|
+
def info(account_id: )
|
36
|
+
response = client.get("/Account/#{account_id}")
|
37
|
+
Resources::Accounts::Account.new(response, response.body[:data])
|
38
|
+
end
|
39
|
+
|
40
|
+
def status(account_id: )
|
41
|
+
response = client.get("/Account/#{account_id}/Status")
|
42
|
+
Resources::Accounts::Status.new(response, response.body[:data])
|
43
|
+
end
|
44
|
+
|
45
|
+
def update_status(account_id: , status_code: )
|
46
|
+
attributes = {
|
47
|
+
status: status_code,
|
48
|
+
}
|
49
|
+
client.patch("/Account/#{account_id}/Status", attributes)
|
50
|
+
status(account_id: account_id)
|
51
|
+
end
|
52
|
+
|
53
|
+
def close(account_id: )
|
54
|
+
update_status(account_id: account_id, status_code: PFS::Resources::Accounts::Status::CODES[:closed])
|
55
|
+
end
|
56
|
+
|
11
57
|
def credit(account_id, currency, amount, fee_code = "**API", description = "Deposit To Card API")
|
12
58
|
attributes = {
|
13
59
|
amount: amount,
|
data/lib/pfs/client.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PFS
|
4
|
+
module Resources
|
5
|
+
module Accounts
|
6
|
+
class Account < Base
|
7
|
+
attr_reader :info,
|
8
|
+
:holder
|
9
|
+
|
10
|
+
map :currencies, :currencies
|
11
|
+
|
12
|
+
def initialize(response, attributes = {})
|
13
|
+
super(response, attributes)
|
14
|
+
@holder = AccountHolder.new(response, attributes.dig(:accountInfo, :cardholder))
|
15
|
+
@info = AccountInfo.new(response, attributes.dig(:accountInfo, :card))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PFS
|
4
|
+
module Resources
|
5
|
+
module Accounts
|
6
|
+
class AccountHolder < Base
|
7
|
+
map :id, :id
|
8
|
+
map :firstName, :first_name
|
9
|
+
map :middleInitial, :middle_initial
|
10
|
+
map :lastName, :last_name
|
11
|
+
map :address1, :address1
|
12
|
+
map :address2, :address2
|
13
|
+
map :address3, :address3
|
14
|
+
map :address4, :address4
|
15
|
+
map :city, :city
|
16
|
+
map :state, :state
|
17
|
+
map :zip, :zip
|
18
|
+
map :countryCode, :country_code
|
19
|
+
map :countryName, :country_name
|
20
|
+
map :countyName, :county_name
|
21
|
+
map :phone, :phone
|
22
|
+
map :dateOfBirth, :date_of_birth
|
23
|
+
map :ssn, :ssn
|
24
|
+
map :securityField1, :security_field1
|
25
|
+
map :securityField2, :security_field2
|
26
|
+
map :securityField3, :security_field3
|
27
|
+
map :securityField4, :security_field4
|
28
|
+
map :userDefined1, :user_defined1
|
29
|
+
map :userDefined2, :user_defined2
|
30
|
+
map :userDefined3, :user_defined3
|
31
|
+
map :userDefined4, :user_defined4
|
32
|
+
map :email, :email
|
33
|
+
map :embossName, :emboss_name
|
34
|
+
map :secondaryAddress1, :secondary_address1
|
35
|
+
map :secondaryAddress2, :secondary_address2
|
36
|
+
map :secondaryAddress3, :secondary_address3
|
37
|
+
map :secondaryAddress4, :secondary_address4
|
38
|
+
map :city2, :city2
|
39
|
+
map :state2, :state2
|
40
|
+
map :zip2, :zip2
|
41
|
+
map :countryCode2, :country_code2
|
42
|
+
map :countryName2, :country_name2
|
43
|
+
map :countyName2, :county_name2
|
44
|
+
map :phone2, :phone2
|
45
|
+
map :sortCode, :sort_code
|
46
|
+
map :sortCodeAccountNumber, :sort_code_account_number
|
47
|
+
map :documentType, :document_type
|
48
|
+
map :documentNumber, :document_number
|
49
|
+
map :documentExpiryDate, :document_expiry_date
|
50
|
+
map :nationality, :nationality
|
51
|
+
map :countryOfIssuance, :country_of_issuance
|
52
|
+
map :gender, :gender
|
53
|
+
map :iban, :iban
|
54
|
+
map :bic, :bic
|
55
|
+
map :atmAccess, :atmAccess
|
56
|
+
map :userDefined, :user_defined
|
57
|
+
map :accountId, :account_id
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PFS
|
4
|
+
module Resources
|
5
|
+
module Accounts
|
6
|
+
class AccountInfo < Base
|
7
|
+
attr_reader :balance
|
8
|
+
|
9
|
+
map :accountBaseCurrency, :account_base_currency
|
10
|
+
map :cardType, :card_type
|
11
|
+
map :accountNumber, :account_number
|
12
|
+
map :bankRoutingNumber, :bank_routing_number
|
13
|
+
map :cnid, :cnid
|
14
|
+
map :cardStatus, :card_status
|
15
|
+
map :pinTriesExceeded, :pin_tries_exceeded
|
16
|
+
map :badPinTries, :bad_pin_tries
|
17
|
+
map :expirationDate, :expiration_date
|
18
|
+
map :cardEffectiveEnd, :card_effective_end
|
19
|
+
map :client, :client
|
20
|
+
map :phoneCardNumber, :phone_card_number
|
21
|
+
map :distributorCode, :distributor_code
|
22
|
+
map :companyName, :company_name
|
23
|
+
map :cardStyle, :card_style
|
24
|
+
map :deliveryType, :delivery_type
|
25
|
+
map :initialLoadProcessed, :initial_load_processed
|
26
|
+
map :loadAmount, :load_amount
|
27
|
+
map :elevatedStatus, :elevated_status
|
28
|
+
map :cardNumber, :card_number
|
29
|
+
map :walletId, :walletId
|
30
|
+
|
31
|
+
def initialize(response, attributes = {})
|
32
|
+
super(response, attributes)
|
33
|
+
@balance = Balance.new(response, attributes[:balance])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PFS
|
4
|
+
module Resources
|
5
|
+
module Accounts
|
6
|
+
class IssuedAccount < Base
|
7
|
+
attr_accessor :id,
|
8
|
+
:availableBalance,
|
9
|
+
:ledgerBalance,
|
10
|
+
:status,
|
11
|
+
:expiryDate,
|
12
|
+
:ddaNumber,
|
13
|
+
:walletId,
|
14
|
+
:clientWalletId,
|
15
|
+
:cardNumber,
|
16
|
+
:cvv2,
|
17
|
+
:accountId,
|
18
|
+
:sequenceCode
|
19
|
+
|
20
|
+
|
21
|
+
alias available availableBalance
|
22
|
+
alias ledger ledgerBalance
|
23
|
+
alias expiration_date expiryDate
|
24
|
+
alias dda_number ddaNumber
|
25
|
+
alias wallet_id walletId
|
26
|
+
alias client_wallet_id clientWalletId
|
27
|
+
alias card_number cardNumber
|
28
|
+
alias account_id accountId
|
29
|
+
alias sequence_code sequenceCode
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PFS
|
4
|
+
module Resources
|
5
|
+
module Accounts
|
6
|
+
class Status < Base
|
7
|
+
CODES = {
|
8
|
+
issued: 0,
|
9
|
+
open: 1,
|
10
|
+
deposit_only: 4,
|
11
|
+
closed: 9
|
12
|
+
}
|
13
|
+
attr_accessor :cardStatus,
|
14
|
+
:description
|
15
|
+
|
16
|
+
alias code cardStatus
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/pfs/resources/base.rb
CHANGED
@@ -12,13 +12,26 @@ module PFS
|
|
12
12
|
send(m, value) if respond_to?(m)
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.map(original_attribute, mapped_attributes)
|
17
|
+
class_eval { attr_writer original_attribute.to_sym }
|
18
|
+
mapped_attributes = [mapped_attributes].flatten
|
19
|
+
mapped_attributes.each do |mapped_attribute|
|
20
|
+
define_method(mapped_attribute) { instance_variable_get("@#{original_attribute}")}
|
21
|
+
end
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
19
27
|
require_relative "collection"
|
28
|
+
require_relative "accounts/issued_account"
|
29
|
+
require_relative "accounts/account"
|
30
|
+
require_relative "accounts/account_info"
|
31
|
+
require_relative "accounts/account_holder"
|
20
32
|
require_relative "accounts/balance"
|
21
33
|
require_relative "accounts/balance_credit"
|
34
|
+
require_relative "accounts/status"
|
22
35
|
require_relative "authentication/token"
|
23
36
|
require_relative "transfers/transfer"
|
24
37
|
require_relative "transactions/transaction"
|
data/lib/pfs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aitor García Rey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -55,8 +55,13 @@ files:
|
|
55
55
|
- lib/pfs/api/transactions_service.rb
|
56
56
|
- lib/pfs/api/transfers_service.rb
|
57
57
|
- lib/pfs/client.rb
|
58
|
+
- lib/pfs/resources/accounts/account.rb
|
59
|
+
- lib/pfs/resources/accounts/account_holder.rb
|
60
|
+
- lib/pfs/resources/accounts/account_info.rb
|
58
61
|
- lib/pfs/resources/accounts/balance.rb
|
59
62
|
- lib/pfs/resources/accounts/balance_credit.rb
|
63
|
+
- lib/pfs/resources/accounts/issued_account.rb
|
64
|
+
- lib/pfs/resources/accounts/status.rb
|
60
65
|
- lib/pfs/resources/authentication/token.rb
|
61
66
|
- lib/pfs/resources/base.rb
|
62
67
|
- lib/pfs/resources/collection.rb
|