besepa 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85c19f910a7f895922a1addd2716c97671f9a415
4
- data.tar.gz: 1e1192efe053c4a1b73264d0e00fc3b0d44c0e70
3
+ metadata.gz: a0bb86187518263eef9f6fb6559f0c84cb41a3d4
4
+ data.tar.gz: 8df710bf478804e8622c7cc67b28f75fdc9dbd9e
5
5
  SHA512:
6
- metadata.gz: 0b8b33b2f4ef7f87b00f6312ae6b1b98f6822b42da544a8c16f9a0902e66e58d4c7caaf74e5fc2ed8dca874ed870feaec2114dd9cfa896f3b86a0611d92b2072
7
- data.tar.gz: ece2ab8ed00c4e17b24f8a0a9f194c14533b3f441cff187c04449ca64e8c1139cf632eb97c5c18b73d63d031cdf60a55e355c440ef4049a979f9d957fc5c1bb8
6
+ metadata.gz: 186e5b5971bc38633e1632dddc500e85a8ab0a2a732ba447c551981b4e49e66d40a6305813e50d6f6a14125c67193a64e30849fc6ddd5f31bd420d5c5295fbdc
7
+ data.tar.gz: f0ba7794948025506ae084587e7ad1d78e8350fc2a401e4c97d362908f869138eff16de03d1b6cdece13d2d7864ded7e311c01722136eb46f047a1e524aff40f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- besepa (0.3.2)
4
+ besepa (0.4.0)
5
5
  faraday (~> 0.9)
6
6
  faraday_middleware (~> 0.9)
7
7
 
@@ -12,7 +12,7 @@ GEM
12
12
  crack (0.4.2)
13
13
  safe_yaml (~> 1.0.0)
14
14
  diff-lcs (1.2.5)
15
- faraday (0.9.1)
15
+ faraday (0.9.2)
16
16
  multipart-post (>= 1.2, < 3)
17
17
  faraday_middleware (0.10.0)
18
18
  faraday (>= 0.7.4, < 0.10)
@@ -80,6 +80,47 @@ module Besepa
80
80
  Subscription.create( params, {:customer_id => id} )
81
81
  end
82
82
 
83
+ # Adds a bank account to this customer.
84
+ # IBAN and BIC are the only mandatory fields. If you already have the mandate signed, you can pass mandate
85
+ # detail's and account will be activated by default. Otherwise BankAccount will be marked as inactive (not usable
86
+ # for creating debits or subscriptions) until mandate is signed. BankAccount includes mandate's info, including
87
+ # signature URL.
88
+ #
89
+ # @param iban
90
+ # @param bic
91
+ # @param bank_name
92
+ # @param mandate_options options to configure mandate
93
+ # - scheme: CORE|COR1|B2B. Default: CORE
94
+ # - signature_date: Date in which this mandate was signed if already signed (Format: YYYY-MM-DD)
95
+ # - reference: Mandate's reference. If none, Besepa will create one.
96
+ # - used: Says if this mandate has already been used or not.
97
+ # - signature_type: Signature to be used: checkbox|sms|biometric
98
+ # - phone_number: Phone number where the signature SMS will be sent in case signature_type==sms is used.
99
+ # - type: ONETIME | RECURRENT. Default: RECURRENT
100
+ # - redirect_after_signature: URL the user should be redirect to after mandate is signed. Default: Besepa's thank you page
101
+ #
102
+ # @return new created Besepa::BankAccount
103
+ def add_bank_account(iban, bic=nil, bank_name=nil, mandate_options={})
104
+ params = {:iban => iban }
105
+ params[:bank_name] = bank_name if bank_name
106
+ params[:bic] = bic if bic
107
+
108
+ params[:mandate] = { scheme: (mandate_options[:scheme] || "CORE"),
109
+ used: (mandate_options[:used] || false),
110
+ mandate_type: (mandate_options[:type] || "RECURRENT") }
111
+
112
+ if mandate_options[:signature_date]
113
+ params[:mandate][:signed_at] = mandate_options[:signature_date]
114
+ params[:mandate][:reference] = mandate_options[:reference] if mandate_options[:reference]
115
+ else
116
+ params[:mandate][:signature_type] = mandate_options[:signature_type] || 'checkbox'
117
+ params[:mandate][:phone_number] = mandate_options[:phone_number] if mandate_options[:phone_number]
118
+ end
119
+ params[:mandate][:redirect_after_signature] = mandate_options[:redirect_after_signature] if mandate_options[:redirect_after_signature]
120
+
121
+ BankAccount.create( params, {:customer_id => id} )
122
+ end
123
+
83
124
  # Adds a bank account to this customer.
84
125
  # IBAN and BIC are the only mandatory fields. If you already have the mandate signed, you can pass mandate
85
126
  # detail's and account will be activated by default. Otherwise BankAccount will be marked as inactive (not usable
@@ -1,6 +1,6 @@
1
1
  module Besepa
2
2
 
3
3
  module Utils
4
- VERSION = '0.3.2'.freeze
4
+ VERSION = '0.4.0'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: besepa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - besepa.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday