bitpesa-sdk 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -4
- data/README.md +19 -7
- data/docs/Sender.md +1 -0
- data/docs/SenderResponse.md +1 -0
- data/docs/SenderResponseExisting.md +8 -0
- data/docs/SenderResponseMeta.md +8 -0
- data/docs/SendersApi.md +2 -0
- data/docs/Transaction.md +1 -0
- data/docs/TransactionResponse.md +1 -0
- data/docs/TransactionResponseExisting.md +9 -0
- data/docs/TransactionResponseMeta.md +8 -0
- data/docs/TransactionsApi.md +2 -0
- data/example/client.rb +47 -9
- data/lib/bitpesa-sdk.rb +4 -0
- data/lib/bitpesa-sdk/api/senders_api.rb +3 -0
- data/lib/bitpesa-sdk/api/transactions_api.rb +3 -0
- data/lib/bitpesa-sdk/api_client.rb +1 -1
- data/lib/bitpesa-sdk/models/sender.rb +12 -2
- data/lib/bitpesa-sdk/models/sender_response.rb +13 -4
- data/lib/bitpesa-sdk/models/sender_response_existing.rb +195 -0
- data/lib/bitpesa-sdk/models/sender_response_meta.rb +195 -0
- data/lib/bitpesa-sdk/models/transaction.rb +11 -1
- data/lib/bitpesa-sdk/models/transaction_response.rb +13 -4
- data/lib/bitpesa-sdk/models/transaction_response_existing.rb +204 -0
- data/lib/bitpesa-sdk/models/transaction_response_meta.rb +195 -0
- data/lib/bitpesa-sdk/version.rb +1 -1
- data/spec/api/account_debits_api_spec.rb +17 -15
- data/spec/api/account_validation_api_spec.rb +10 -10
- data/spec/api/accounts_api_spec.rb +13 -13
- data/spec/api/api_logs_api_spec.rb +15 -11
- data/spec/api/currency_info_api_spec.rb +13 -13
- data/spec/api/documents_api_spec.rb +16 -14
- data/spec/api/logs_api_spec.rb +15 -11
- data/spec/api/payment_methods_api_spec.rb +11 -11
- data/spec/api/payout_methods_api_spec.rb +55 -11
- data/spec/api/recipients_api_spec.rb +23 -18
- data/spec/api/senders_api_spec.rb +26 -21
- data/spec/api/transactions_api_spec.rb +48 -22
- data/spec/api/webhooks_api_spec.rb +20 -20
- data/spec/api_client_spec.rb +52 -90
- data/spec/configuration_spec.rb +13 -13
- data/spec/models/account_meta_spec.rb +5 -6
- data/spec/models/api_log_spec.rb +16 -17
- data/spec/models/currency_spec.rb +27 -16
- data/spec/models/debit_request_spec.rb +9 -34
- data/spec/models/debit_spec.rb +42 -13
- data/spec/models/document_request_spec.rb +9 -56
- data/spec/models/document_spec.rb +71 -8
- data/spec/models/pagination_spec.rb +33 -10
- data/spec/models/payin_method_details_mobile_spec.rb +6 -7
- data/spec/models/payin_method_details_ngn_bank_spec.rb +5 -6
- data/spec/models/payment_method_spec.rb +19 -14
- data/spec/models/payout_method_details_balance_spec.rb +5 -6
- data/spec/models/payout_method_details_ghs_bank_spec.rb +8 -9
- data/spec/models/payout_method_details_iban_spec.rb +9 -10
- data/spec/models/payout_method_details_mad_cash_spec.rb +15 -24
- data/spec/models/payout_method_details_mobile_spec.rb +7 -8
- data/spec/models/payout_method_details_ngn_bank_spec.rb +9 -14
- data/spec/models/payout_method_details_xof_mobile_spec.rb +8 -13
- data/spec/models/payout_method_request_spec.rb +6 -19
- data/spec/models/payout_method_response_spec.rb +6 -19
- data/spec/models/payout_method_spec.rb +18 -19
- data/spec/models/recipient_request_spec.rb +6 -25
- data/spec/models/recipient_response_spec.rb +6 -103
- data/spec/models/recipient_spec.rb +127 -8
- data/spec/models/sender_request_spec.rb +9 -104
- data/spec/models/sender_response_existing_spec.rb +41 -0
- data/spec/models/sender_response_meta_spec.rb +41 -0
- data/spec/models/sender_response_spec.rb +8 -103
- data/spec/models/sender_spec.rb +167 -8
- data/spec/models/transaction_request_spec.rb +9 -16
- data/spec/models/transaction_response_existing_spec.rb +47 -0
- data/spec/models/transaction_response_meta_spec.rb +41 -0
- data/spec/models/transaction_response_spec.rb +8 -75
- data/spec/models/transaction_spec.rb +84 -13
- data/spec/models/transaction_traits_spec.rb +6 -7
- data/spec/models/webhook_definition_request_spec.rb +6 -19
- data/spec/models/webhook_log_metadata_request_spec.rb +10 -11
- data/spec/models/webhook_log_metadata_response_spec.rb +10 -11
- data/spec/models/webhook_log_metadata_spec.rb +17 -18
- data/spec/models/webhook_log_spec.rb +13 -14
- data/spec/models/webhook_spec.rb +7 -8
- data/spec/spec_helper.rb +4 -4
- metadata +19 -309
- data/example/.LICENSE.un~ +0 -0
- data/example/.client.rb.un~ +0 -0
- data/spec/api/transaction_requests_api_spec.rb +0 -76
- data/spec/models/account_base_spec.rb +0 -48
- data/spec/models/api_log_base_spec.rb +0 -90
- data/spec/models/body_spec.rb +0 -58
- data/spec/models/currency_base_spec.rb +0 -84
- data/spec/models/debit_base_spec.rb +0 -66
- data/spec/models/debit_error_response_spec.rb +0 -72
- data/spec/models/debit_valid_response_spec.rb +0 -72
- data/spec/models/default_document_spec.rb +0 -94
- data/spec/models/default_recipient_spec.rb +0 -60
- data/spec/models/default_sender_spec.rb +0 -142
- data/spec/models/default_webhook_spec.rb +0 -60
- data/spec/models/document_base_spec.rb +0 -88
- data/spec/models/document_error_response_spec.rb +0 -94
- data/spec/models/document_valid_response_spec.rb +0 -94
- data/spec/models/full_invalid_transaction_request_spec.rb +0 -78
- data/spec/models/full_invalid_transaction_spec.rb +0 -66
- data/spec/models/full_valid_transaction_request_spec.rb +0 -66
- data/spec/models/full_valid_transaction_spec.rb +0 -60
- data/spec/models/inline_response_200_10_spec.rb +0 -42
- data/spec/models/inline_response_200_11_spec.rb +0 -48
- data/spec/models/inline_response_200_12_spec.rb +0 -42
- data/spec/models/inline_response_200_13_spec.rb +0 -48
- data/spec/models/inline_response_200_14_spec.rb +0 -42
- data/spec/models/inline_response_200_15_spec.rb +0 -48
- data/spec/models/inline_response_200_16_spec.rb +0 -48
- data/spec/models/inline_response_200_17_spec.rb +0 -48
- data/spec/models/inline_response_200_18_spec.rb +0 -42
- data/spec/models/inline_response_200_19_spec.rb +0 -48
- data/spec/models/inline_response_200_1_spec.rb +0 -48
- data/spec/models/inline_response_200_20_spec.rb +0 -42
- data/spec/models/inline_response_200_21_object_spec.rb +0 -42
- data/spec/models/inline_response_200_21_spec.rb +0 -42
- data/spec/models/inline_response_200_22_object_spec.rb +0 -42
- data/spec/models/inline_response_200_22_spec.rb +0 -42
- data/spec/models/inline_response_200_23_object_spec.rb +0 -42
- data/spec/models/inline_response_200_23_spec.rb +0 -48
- data/spec/models/inline_response_200_24_spec.rb +0 -42
- data/spec/models/inline_response_200_25_spec.rb +0 -42
- data/spec/models/inline_response_200_26_spec.rb +0 -42
- data/spec/models/inline_response_200_27_spec.rb +0 -48
- data/spec/models/inline_response_200_28_spec.rb +0 -42
- data/spec/models/inline_response_200_29_spec.rb +0 -48
- data/spec/models/inline_response_200_2_object_spec.rb +0 -42
- data/spec/models/inline_response_200_2_spec.rb +0 -42
- data/spec/models/inline_response_200_30_spec.rb +0 -42
- data/spec/models/inline_response_200_31_spec.rb +0 -48
- data/spec/models/inline_response_200_32_spec.rb +0 -42
- data/spec/models/inline_response_200_33_spec.rb +0 -48
- data/spec/models/inline_response_200_34_spec.rb +0 -42
- data/spec/models/inline_response_200_35_spec.rb +0 -48
- data/spec/models/inline_response_200_36_spec.rb +0 -48
- data/spec/models/inline_response_200_37_spec.rb +0 -48
- data/spec/models/inline_response_200_38_spec.rb +0 -42
- data/spec/models/inline_response_200_39_spec.rb +0 -48
- data/spec/models/inline_response_200_3_spec.rb +0 -48
- data/spec/models/inline_response_200_40_spec.rb +0 -42
- data/spec/models/inline_response_200_4_object_spec.rb +0 -42
- data/spec/models/inline_response_200_4_spec.rb +0 -42
- data/spec/models/inline_response_200_5_spec.rb +0 -42
- data/spec/models/inline_response_200_6_spec.rb +0 -42
- data/spec/models/inline_response_200_7_spec.rb +0 -48
- data/spec/models/inline_response_200_8_spec.rb +0 -42
- data/spec/models/inline_response_200_9_spec.rb +0 -48
- data/spec/models/inline_response_200_spec.rb +0 -48
- data/spec/models/inline_response_201_10_spec.rb +0 -42
- data/spec/models/inline_response_201_11_spec.rb +0 -42
- data/spec/models/inline_response_201_1_spec.rb +0 -42
- data/spec/models/inline_response_201_2_spec.rb +0 -42
- data/spec/models/inline_response_201_3_spec.rb +0 -42
- data/spec/models/inline_response_201_4_spec.rb +0 -42
- data/spec/models/inline_response_201_5_spec.rb +0 -42
- data/spec/models/inline_response_201_6_spec.rb +0 -42
- data/spec/models/inline_response_201_7_spec.rb +0 -42
- data/spec/models/inline_response_201_8_spec.rb +0 -42
- data/spec/models/inline_response_201_9_spec.rb +0 -42
- data/spec/models/inline_response_201_spec.rb +0 -42
- data/spec/models/inline_response_400_1_spec.rb +0 -48
- data/spec/models/inline_response_400_spec.rb +0 -48
- data/spec/models/inline_response_422_10_spec.rb +0 -42
- data/spec/models/inline_response_422_11_spec.rb +0 -42
- data/spec/models/inline_response_422_12_spec.rb +0 -42
- data/spec/models/inline_response_422_13_spec.rb +0 -42
- data/spec/models/inline_response_422_14_spec.rb +0 -42
- data/spec/models/inline_response_422_1_meta_spec.rb +0 -42
- data/spec/models/inline_response_422_1_object_spec.rb +0 -42
- data/spec/models/inline_response_422_1_spec.rb +0 -42
- data/spec/models/inline_response_422_2_spec.rb +0 -42
- data/spec/models/inline_response_422_3_spec.rb +0 -42
- data/spec/models/inline_response_422_4_spec.rb +0 -42
- data/spec/models/inline_response_422_5_spec.rb +0 -42
- data/spec/models/inline_response_422_6_spec.rb +0 -42
- data/spec/models/inline_response_422_7_meta_spec.rb +0 -42
- data/spec/models/inline_response_422_7_spec.rb +0 -42
- data/spec/models/inline_response_422_8_meta_spec.rb +0 -42
- data/spec/models/inline_response_422_8_object_spec.rb +0 -42
- data/spec/models/inline_response_422_8_spec.rb +0 -48
- data/spec/models/inline_response_422_9_spec.rb +0 -42
- data/spec/models/inline_response_422_meta_spec.rb +0 -42
- data/spec/models/inline_response_422_object_spec.rb +0 -42
- data/spec/models/inline_response_422_spec.rb +0 -48
- data/spec/models/invalid_debit_spec.rb +0 -78
- data/spec/models/invalid_document_spec.rb +0 -100
- data/spec/models/invalid_recipient_spec.rb +0 -66
- data/spec/models/invalid_sender_spec.rb +0 -148
- data/spec/models/invalid_webhook_spec.rb +0 -60
- data/spec/models/meta_2_pagination_spec.rb +0 -66
- data/spec/models/meta_2_spec.rb +0 -42
- data/spec/models/meta_pagination_spec.rb +0 -66
- data/spec/models/meta_spec.rb +0 -42
- data/spec/models/object_spec.rb +0 -48
- data/spec/models/opposite_payment_method_base_spec.rb +0 -72
- data/spec/models/opposite_payment_method_spec.rb +0 -72
- data/spec/models/pagination_pagination_spec.rb +0 -66
- data/spec/models/payin_method_base_spec.rb +0 -66
- data/spec/models/payin_method_details_base_spec.rb +0 -36
- data/spec/models/payin_method_type_base_spec.rb +0 -42
- data/spec/models/payin_method_type_spec.rb +0 -42
- data/spec/models/payment_method_base_spec.rb +0 -66
- data/spec/models/payout_method_base_spec.rb +0 -54
- data/spec/models/payout_method_details_base_spec.rb +0 -36
- data/spec/models/payout_method_error_response_spec.rb +0 -60
- data/spec/models/payout_method_valid_response_spec.rb +0 -60
- data/spec/models/recipient_base_spec.rb +0 -54
- data/spec/models/recipient_error_response_spec.rb +0 -60
- data/spec/models/recipient_valid_response_spec.rb +0 -60
- data/spec/models/sender_base_spec.rb +0 -136
- data/spec/models/sender_error_response_spec.rb +0 -142
- data/spec/models/sender_existing_request_spec.rb +0 -42
- data/spec/models/sender_full_request_spec.rb +0 -136
- data/spec/models/sender_valid_response_spec.rb +0 -142
- data/spec/models/transaction_base_spec.rb +0 -60
- data/spec/models/transaction_error_response_spec.rb +0 -66
- data/spec/models/transaction_request_base_spec.rb +0 -48
- data/spec/models/transaction_request_error_response_spec.rb +0 -54
- data/spec/models/transaction_request_request_spec.rb +0 -48
- data/spec/models/transaction_request_valid_response_spec.rb +0 -54
- data/spec/models/transaction_valid_response_spec.rb +0 -66
- data/spec/models/valid_debit_spec.rb +0 -90
- data/spec/models/webhook_base_spec.rb +0 -54
- data/spec/models/webhook_definition_base_spec.rb +0 -54
- data/spec/models/webhook_definition_error_response_spec.rb +0 -60
- data/spec/models/webhook_definition_valid_response_spec.rb +0 -60
- data/spec/models/webhook_error_response_spec.rb +0 -60
- data/spec/models/webhook_log_base_metadata_params_spec.rb +0 -42
- data/spec/models/webhook_log_base_metadata_request_spec.rb +0 -54
- data/spec/models/webhook_log_base_metadata_response_spec.rb +0 -54
- data/spec/models/webhook_log_base_metadata_spec.rb +0 -96
- data/spec/models/webhook_log_base_spec.rb +0 -72
- data/spec/models/webhook_log_metadata_params_spec.rb +0 -42
- data/spec/models/webhook_request_spec.rb +0 -54
- data/spec/models/webhook_valid_response_spec.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10dbee3b9f41bb3cbbe88d1f0da8dee44ec7cf15
|
4
|
+
data.tar.gz: d6c3f97311cbaa3918ba1777f140cd5e59b51f5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39e0a2e0d796eade2d93c368813a6ab40f551fb4d00999b52ecc6f679f5ac6397aadef31da2c7b2c25064d759976c93254ea59cd611b9fb7c5d8d7a6aea17389
|
7
|
+
data.tar.gz: b2eb4b66f1810734df687a252b8f85d6613679ef038dbd911baa48832942583a4172e6218dd332d5b86811397d6cdd248ef7e6d4c51452fd8997058882ea3941
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bitpesa-sdk (
|
4
|
+
bitpesa-sdk (0.2.0)
|
5
5
|
activesupport (~> 5)
|
6
6
|
json (~> 2.1, >= 2.1.0)
|
7
7
|
typhoeus (~> 1.0, >= 1.0.1)
|
@@ -9,8 +9,8 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
ZenTest (4.11.
|
13
|
-
activesupport (5.2.
|
12
|
+
ZenTest (4.11.2)
|
13
|
+
activesupport (5.2.3)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 0.7, < 2)
|
16
16
|
minitest (~> 5.1)
|
@@ -77,6 +77,7 @@ PLATFORMS
|
|
77
77
|
ruby
|
78
78
|
|
79
79
|
DEPENDENCIES
|
80
|
+
ZenTest (~> 4.11, >= 4.11.2)
|
80
81
|
autotest (~> 4.4, >= 4.4.6)
|
81
82
|
autotest-fsevent (~> 0.2, >= 0.2.12)
|
82
83
|
autotest-growl (~> 0.2, >= 0.2.16)
|
@@ -89,4 +90,4 @@ DEPENDENCIES
|
|
89
90
|
webmock (~> 1.24, >= 1.24.3)
|
90
91
|
|
91
92
|
BUNDLED WITH
|
92
|
-
|
93
|
+
2.0.1
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# bitpesa
|
1
|
+
# bitpesa-sdk
|
2
2
|
|
3
3
|
Bitpesa - the Ruby gem for the BitPesa API
|
4
4
|
|
@@ -7,9 +7,17 @@ Reference documentation for the BitPesa API V1
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
8
8
|
|
9
9
|
- API version: 1.0
|
10
|
-
- Package version:
|
10
|
+
- Package version: 0.2.0
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
|
+
For more information, please visit:
|
14
|
+
|
15
|
+
* [API Documentation](https://github.com/bitpesa/api-documentation)
|
16
|
+
* [Onboarding guide](https://github.com/bitpesa/api-documentation/blob/master/quick-integration.md)
|
17
|
+
* [Transaction flow](https://github.com/bitpesa/api-documentation/blob/master/transaction-flow.md)
|
18
|
+
* [Additional features](https://github.com/bitpesa/api-documentation/blob/master/additional-features.md)
|
19
|
+
* [API Specification](https://api.bitpesa.co/documentation)
|
20
|
+
|
13
21
|
## Installation
|
14
22
|
|
15
23
|
### Build a gem
|
@@ -17,27 +25,27 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g
|
|
17
25
|
To build the Ruby code into a gem:
|
18
26
|
|
19
27
|
```shell
|
20
|
-
gem build bitpesa.gemspec
|
28
|
+
gem build bitpesa-sdk.gemspec
|
21
29
|
```
|
22
30
|
|
23
31
|
Then either install the gem locally:
|
24
32
|
|
25
33
|
```shell
|
26
|
-
gem install ./bitpesa-
|
34
|
+
gem install ./bitpesa-sdk-0.2.0.gem
|
27
35
|
```
|
28
|
-
(for development, run `gem install --dev ./bitpesa-
|
36
|
+
(for development, run `gem install --dev ./bitpesa-sdk-0.2.0.gem` to install the development dependencies)
|
29
37
|
|
30
38
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
39
|
|
32
40
|
Finally add this to the Gemfile:
|
33
41
|
|
34
|
-
gem 'bitpesa', '~>
|
42
|
+
gem 'bitpesa-sdk', '~> 0.2.0'
|
35
43
|
|
36
44
|
### Install from Git
|
37
45
|
|
38
46
|
If the Ruby gem is hosted at a git repository: https://github.com/bitpesa/bitpesa-ruby-sdk, then add the following in the Gemfile:
|
39
47
|
|
40
|
-
gem 'bitpesa', :git => 'https://github.com/bitpesa/bitpesa-ruby-sdk.git'
|
48
|
+
gem 'bitpesa-sdk', :git => 'https://github.com/bitpesa/bitpesa-ruby-sdk.git'
|
41
49
|
|
42
50
|
### Include the Ruby code directly
|
43
51
|
|
@@ -201,12 +209,16 @@ Class | Method | HTTP request | Description
|
|
201
209
|
- [Bitpesa::SenderListResponse](docs/SenderListResponse.md)
|
202
210
|
- [Bitpesa::SenderRequest](docs/SenderRequest.md)
|
203
211
|
- [Bitpesa::SenderResponse](docs/SenderResponse.md)
|
212
|
+
- [Bitpesa::SenderResponseExisting](docs/SenderResponseExisting.md)
|
213
|
+
- [Bitpesa::SenderResponseMeta](docs/SenderResponseMeta.md)
|
204
214
|
- [Bitpesa::SenderState](docs/SenderState.md)
|
205
215
|
- [Bitpesa::SenderWebhook](docs/SenderWebhook.md)
|
206
216
|
- [Bitpesa::Transaction](docs/Transaction.md)
|
207
217
|
- [Bitpesa::TransactionListResponse](docs/TransactionListResponse.md)
|
208
218
|
- [Bitpesa::TransactionRequest](docs/TransactionRequest.md)
|
209
219
|
- [Bitpesa::TransactionResponse](docs/TransactionResponse.md)
|
220
|
+
- [Bitpesa::TransactionResponseExisting](docs/TransactionResponseExisting.md)
|
221
|
+
- [Bitpesa::TransactionResponseMeta](docs/TransactionResponseMeta.md)
|
210
222
|
- [Bitpesa::TransactionState](docs/TransactionState.md)
|
211
223
|
- [Bitpesa::TransactionTraits](docs/TransactionTraits.md)
|
212
224
|
- [Bitpesa::TransactionWebhook](docs/TransactionWebhook.md)
|
data/docs/Sender.md
CHANGED
@@ -27,6 +27,7 @@ Name | Type | Description | Notes
|
|
27
27
|
**metadata** | [**Object**](.md) | Metadata of sender. You can store any detail specific to your integration here (for example the local ID of the sender on your end). When requesting sender details you will receive the sent metadata back. Also when sending sender related webhooks you will receive the details stored here as well. | [optional]
|
28
28
|
**state** | [**SenderState**](SenderState.md) | | [optional]
|
29
29
|
**id** | **String** | | [optional]
|
30
|
+
**external_id** | **String** | Optional ID that is supplied by partner linking it to the partner's own Sender ID. Note: if present we will validate whether the sent ID is a duplicate in our system or not. | [optional]
|
30
31
|
**errors** | **Hash<String, Array<ValidationErrorDescription>>** | The fields that have some problems and don't pass validation | [optional]
|
31
32
|
|
32
33
|
|
data/docs/SenderResponse.md
CHANGED
data/docs/SendersApi.md
CHANGED
@@ -152,6 +152,7 @@ opts = {
|
|
152
152
|
per: 10 # Integer | The number of results to load per page (defaults to 10)
|
153
153
|
created_at_from: 'created_at_from_example' # String | Start date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
154
154
|
created_at_to: 'created_at_to_example' # String | End date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
155
|
+
external_id: 'external_id_example' # String | Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
155
156
|
}
|
156
157
|
|
157
158
|
begin
|
@@ -177,6 +178,7 @@ Name | Type | Description | Notes
|
|
177
178
|
**per** | **Integer**| The number of results to load per page (defaults to 10) | [optional]
|
178
179
|
**created_at_from** | **String**| Start date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08` | [optional]
|
179
180
|
**created_at_to** | **String**| End date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08` | [optional]
|
181
|
+
**external_id** | **String**| Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87` | [optional]
|
180
182
|
|
181
183
|
### Return type
|
182
184
|
|
data/docs/Transaction.md
CHANGED
@@ -16,6 +16,7 @@ Name | Type | Description | Notes
|
|
16
16
|
**due_amount** | **Float** | The amount needed to be paid in for the transaction to get funded | [optional]
|
17
17
|
**created_at** | **DateTime** | The time the transaction was created | [optional]
|
18
18
|
**expires_at** | **DateTime** | The latest time when the transaction has to be funded, otherwise it will be cancelled | [optional]
|
19
|
+
**external_id** | **String** | Optional ID that is supplied by partner linking it to the partner's own Sender ID. Note: if present we will validate whether the sent ID is a duplicate in our system or not. | [optional]
|
19
20
|
**id** | **String** | | [optional]
|
20
21
|
**errors** | **Hash<String, Array<ValidationErrorDescription>>** | The fields that have some problems and don't pass validation | [optional]
|
21
22
|
|
data/docs/TransactionResponse.md
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Bitpesa::TransactionResponseExisting
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**sender** | [**Sender**](Sender.md) | | [optional]
|
7
|
+
**transaction** | [**Transaction**](Transaction.md) | | [optional]
|
8
|
+
|
9
|
+
|
data/docs/TransactionsApi.md
CHANGED
@@ -152,6 +152,7 @@ api_instance = Bitpesa::TransactionsApi.new
|
|
152
152
|
opts = {
|
153
153
|
page: 1 # Integer | The page number to request (defaults to 1)
|
154
154
|
per: 10 # Integer | The number of results to load per page (defaults to 10)
|
155
|
+
external_id: 'external_id_example' # String | Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
155
156
|
}
|
156
157
|
|
157
158
|
begin
|
@@ -175,6 +176,7 @@ Name | Type | Description | Notes
|
|
175
176
|
------------- | ------------- | ------------- | -------------
|
176
177
|
**page** | **Integer**| The page number to request (defaults to 1) | [optional]
|
177
178
|
**per** | **Integer**| The number of results to load per page (defaults to 10) | [optional]
|
179
|
+
**external_id** | **String**| Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87` | [optional]
|
178
180
|
|
179
181
|
### Return type
|
180
182
|
|
data/example/client.rb
CHANGED
@@ -4,15 +4,15 @@ require 'securerandom'
|
|
4
4
|
require 'bundler/inline'
|
5
5
|
|
6
6
|
gemfile do
|
7
|
-
gem "bitpesa-sdk", "=0.
|
7
|
+
gem "bitpesa-sdk", "=0.2.0"
|
8
8
|
end
|
9
9
|
|
10
10
|
require 'bitpesa-sdk'
|
11
11
|
|
12
12
|
credentials = {
|
13
|
-
key: "
|
14
|
-
secret: "
|
15
|
-
host: '
|
13
|
+
key: "<key>",
|
14
|
+
secret: "<secret>",
|
15
|
+
host: 'https://api-sandbox.bitpesa.co/v1',
|
16
16
|
}
|
17
17
|
|
18
18
|
class Client
|
@@ -21,7 +21,6 @@ class Client
|
|
21
21
|
config.api_key = credentials[:key]
|
22
22
|
config.api_secret = credentials[:secret]
|
23
23
|
config.host = credentials[:host]
|
24
|
-
config.scheme = 'http'
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
@@ -73,11 +72,15 @@ class Client
|
|
73
72
|
sender.postal_code = "798983"
|
74
73
|
sender.birth_date = "1900-12-31"
|
75
74
|
sender.ip = '127.0.0.1'
|
75
|
+
sender.external_id = 'SENDER-2b59def0' # Optional field for customer ID
|
76
76
|
|
77
77
|
sender_request = Bitpesa::SenderRequest.new
|
78
78
|
sender_request.sender = sender
|
79
|
-
api.post_senders(sender_request)
|
80
|
-
|
79
|
+
sender_response = api.post_senders(sender_request)
|
80
|
+
created_sender = sender_response.object
|
81
|
+
|
82
|
+
puts "Sender created! ID: #{created_sender.id}"
|
83
|
+
created_sender.id
|
81
84
|
rescue Bitpesa::ApiError => e
|
82
85
|
if e.validation_error
|
83
86
|
puts e.response_object("SenderResponse").object.errors
|
@@ -87,6 +90,20 @@ class Client
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
|
93
|
+
def get_sender_by_external_id_example
|
94
|
+
begin
|
95
|
+
opts = { external_id: 'SENDER-2b59def0' }
|
96
|
+
sender = Bitpesa::SendersApi.new
|
97
|
+
sender.get_senders(opts).object.first
|
98
|
+
rescue Bitpesa::ApiError => e
|
99
|
+
if e.validation_error
|
100
|
+
puts e.response_object("SenderResponse").object.errors
|
101
|
+
else
|
102
|
+
puts "Exception when calling SendersApi#get_sender_by_external_id_example: #{e}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
90
107
|
def update_sender_example
|
91
108
|
begin
|
92
109
|
api = Bitpesa::SendersApi.new
|
@@ -95,7 +112,7 @@ class Client
|
|
95
112
|
sender_request = Bitpesa::SenderRequest.new
|
96
113
|
sender_request.sender = sender
|
97
114
|
|
98
|
-
api.patch_sender('
|
115
|
+
api.patch_sender('ec33484c-4456-4625-a823-9704a3a54e68', sender_request)
|
99
116
|
rescue Bitpesa::ApiError => e
|
100
117
|
if e.validation_error
|
101
118
|
puts e.response_object("SenderResponse").object.errors
|
@@ -111,6 +128,8 @@ class Client
|
|
111
128
|
transaction = Bitpesa::Transaction.new
|
112
129
|
|
113
130
|
sender = Bitpesa::Sender.new
|
131
|
+
# When adding a sender to transaction, please use either an id or external_id. Providing both will result in a validation error.
|
132
|
+
# Please see our documentation at https://github.com/bitpesa/api-documentation/blob/master/transaction-flow.md#external-id
|
114
133
|
sender.id = 'ec33484c-4456-4625-a823-9704a3a54e68'
|
115
134
|
|
116
135
|
ngn_bank_details = Bitpesa::PayoutMethodDetails.new
|
@@ -129,6 +148,7 @@ class Client
|
|
129
148
|
recipient.requested_currency = 'NGN'
|
130
149
|
recipient.payout_method = payout_method
|
131
150
|
|
151
|
+
transaction.external_id = 'TRANSACTION-1f834add' # Optional field for customer's ID
|
132
152
|
transaction.input_currency = 'GBP'
|
133
153
|
transaction.sender = sender
|
134
154
|
transaction.recipients = [recipient]
|
@@ -149,6 +169,20 @@ class Client
|
|
149
169
|
end
|
150
170
|
end
|
151
171
|
|
172
|
+
def get_transaction_by_external_id_example
|
173
|
+
begin
|
174
|
+
opts = { external_id: 'TRANSACTION-1f834add' }
|
175
|
+
transaction = Bitpesa::TransactionsApi.new
|
176
|
+
transaction.get_transactions(opts).object.first
|
177
|
+
rescue Bitpesa::ApiError => e
|
178
|
+
if e.validation_error
|
179
|
+
puts e.response_object("TransactionResponse").object.errors
|
180
|
+
else
|
181
|
+
puts "Exception when calling TransactionsApi#get_transaction_by_external_id_example: #{e}"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
152
186
|
def create_and_fund_transaction_example
|
153
187
|
transaction_id = create_transaction_example
|
154
188
|
if transaction_id.nil?
|
@@ -387,9 +421,13 @@ class Client
|
|
387
421
|
end
|
388
422
|
end
|
389
423
|
|
390
|
-
|
424
|
+
# client = Client.new(credentials)
|
391
425
|
# client.list_currencies_example
|
392
426
|
# client.account_validation_example
|
427
|
+
# client.create_sender_example
|
428
|
+
# client.get_sender_by_external_id_example
|
429
|
+
# client.update_sender_example
|
393
430
|
# client.create_transaction_example
|
431
|
+
# client.get_transaction_by_external_id_example
|
394
432
|
# client.create_and_fund_transaction_example
|
395
433
|
# client.webhook_parse_example
|
data/lib/bitpesa-sdk.rb
CHANGED
@@ -85,12 +85,16 @@ require 'bitpesa-sdk/models/sender'
|
|
85
85
|
require 'bitpesa-sdk/models/sender_list_response'
|
86
86
|
require 'bitpesa-sdk/models/sender_request'
|
87
87
|
require 'bitpesa-sdk/models/sender_response'
|
88
|
+
require 'bitpesa-sdk/models/sender_response_existing'
|
89
|
+
require 'bitpesa-sdk/models/sender_response_meta'
|
88
90
|
require 'bitpesa-sdk/models/sender_state'
|
89
91
|
require 'bitpesa-sdk/models/sender_webhook'
|
90
92
|
require 'bitpesa-sdk/models/transaction'
|
91
93
|
require 'bitpesa-sdk/models/transaction_list_response'
|
92
94
|
require 'bitpesa-sdk/models/transaction_request'
|
93
95
|
require 'bitpesa-sdk/models/transaction_response'
|
96
|
+
require 'bitpesa-sdk/models/transaction_response_existing'
|
97
|
+
require 'bitpesa-sdk/models/transaction_response_meta'
|
94
98
|
require 'bitpesa-sdk/models/transaction_state'
|
95
99
|
require 'bitpesa-sdk/models/transaction_traits'
|
96
100
|
require 'bitpesa-sdk/models/transaction_webhook'
|
@@ -146,6 +146,7 @@ module Bitpesa
|
|
146
146
|
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
147
147
|
# @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
148
148
|
# @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
149
|
+
# @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
149
150
|
# @return [SenderListResponse]
|
150
151
|
def get_senders(opts = {})
|
151
152
|
data, _status_code, _headers = get_senders_with_http_info(opts)
|
@@ -159,6 +160,7 @@ module Bitpesa
|
|
159
160
|
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
160
161
|
# @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
161
162
|
# @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
163
|
+
# @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
162
164
|
# @return [Array<(SenderListResponse, Fixnum, Hash)>] SenderListResponse data, response status code and response headers
|
163
165
|
def get_senders_with_http_info(opts = {})
|
164
166
|
if @api_client.config.debugging
|
@@ -173,6 +175,7 @@ module Bitpesa
|
|
173
175
|
query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?
|
174
176
|
query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?
|
175
177
|
query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil?
|
178
|
+
query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?
|
176
179
|
|
177
180
|
# header parameters
|
178
181
|
header_params = {}
|
@@ -146,6 +146,7 @@ module Bitpesa
|
|
146
146
|
# @param [Hash] opts the optional parameters
|
147
147
|
# @option opts [Integer] :page The page number to request (defaults to 1)
|
148
148
|
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
149
|
+
# @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
149
150
|
# @return [TransactionListResponse]
|
150
151
|
def get_transactions(opts = {})
|
151
152
|
data, _status_code, _headers = get_transactions_with_http_info(opts)
|
@@ -157,6 +158,7 @@ module Bitpesa
|
|
157
158
|
# @param [Hash] opts the optional parameters
|
158
159
|
# @option opts [Integer] :page The page number to request (defaults to 1)
|
159
160
|
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
161
|
+
# @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
160
162
|
# @return [Array<(TransactionListResponse, Fixnum, Hash)>] TransactionListResponse data, response status code and response headers
|
161
163
|
def get_transactions_with_http_info(opts = {})
|
162
164
|
if @api_client.config.debugging
|
@@ -169,6 +171,7 @@ module Bitpesa
|
|
169
171
|
query_params = {}
|
170
172
|
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
171
173
|
query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?
|
174
|
+
query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?
|
172
175
|
|
173
176
|
# header parameters
|
174
177
|
header_params = {}
|
@@ -35,7 +35,7 @@ module Bitpesa
|
|
35
35
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
36
36
|
def initialize(config = Configuration.default)
|
37
37
|
@config = config
|
38
|
-
@user_agent = "
|
38
|
+
@user_agent = "BitPesa Ruby Client"
|
39
39
|
@default_headers = {
|
40
40
|
'Content-Type' => 'application/json',
|
41
41
|
'User-Agent' => @user_agent
|
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.0.0-beta2
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module Bitpesa
|
16
|
-
# This contains the details of the sender. The first time a specific sender is used the full details should be provided. Once a sender is created and is used, the next time you MUST only send the ID of the sender. This is so we can match the same sender across multiple transactions for KYC and audit purposes. Personal Sender Example: ```json { \"country\": \"UG\", \"phone_country\": \"UG\", \"phone_number\": \"752403639\", \"email\": \"example@home.org\", \"first_name\": \"Johnny\", \"last_name\": \"English\", \"city\": \"Kampala\", \"street\": \"Unknown 17-3\", \"address_description\": \"Description of address\", \"postal_code\": \"798983\", \"birth_date\": \"1900-12-31\", \"documents\": [ ], \"ip\": \"127.0.0.1\", \"metadata\": { } } ``` Business Sender Example: ```json { \"type\": \"business\", \"country\": \"UG\", \"phone_country\": \"UG\", \"phone_number\": \"752403639\", \"email\": \"example@home.org\", \"name\": \"MyCompany\", \"city\": \"Kampala\", \"street\": \"Unknown 17-3\", \"postal_code\": \"798983\", \"address_description\": \"Description of address\", \"documents\": [ ], \"ip\": \"127.0.0.1\", \"metadata\": { } } ``` [Sender in the API documentation](https://github.com/bitpesa/api-documentation/blob/master/transaction-flow.md#sender)
|
16
|
+
# This contains the details of the sender. The first time a specific sender is used the full details should be provided. Once a sender is created and is used, the next time you MUST only send the ID of the sender. This is so we can match the same sender across multiple transactions for KYC and audit purposes. Personal Sender Example: ```json { \"country\": \"UG\", \"phone_country\": \"UG\", \"phone_number\": \"752403639\", \"email\": \"example@home.org\", \"first_name\": \"Johnny\", \"last_name\": \"English\", \"city\": \"Kampala\", \"street\": \"Unknown 17-3\", \"address_description\": \"Description of address\", \"postal_code\": \"798983\", \"birth_date\": \"1900-12-31\", \"documents\": [ ], \"ip\": \"127.0.0.1\", \"external_id\": \"806ec63a-a5a7-43cc-9d75-1ee74fbcc026\", \"metadata\": { } } ``` Business Sender Example: ```json { \"type\": \"business\", \"country\": \"UG\", \"phone_country\": \"UG\", \"phone_number\": \"752403639\", \"email\": \"example@home.org\", \"name\": \"MyCompany\", \"city\": \"Kampala\", \"street\": \"Unknown 17-3\", \"postal_code\": \"798983\", \"address_description\": \"Description of address\", \"documents\": [ ], \"ip\": \"127.0.0.1\", \"external_id\": \"806ec63a-a5a7-43cc-9d75-1ee74fbcc026\", \"metadata\": { } } ``` [Sender in the API documentation](https://github.com/bitpesa/api-documentation/blob/master/transaction-flow.md#sender)
|
17
17
|
class Sender
|
18
18
|
# Type of sender to create - either person or business (defaults to person)
|
19
19
|
attr_accessor :type
|
@@ -85,6 +85,9 @@ module Bitpesa
|
|
85
85
|
|
86
86
|
attr_accessor :id
|
87
87
|
|
88
|
+
# Optional ID that is supplied by partner linking it to the partner's own Sender ID. Note: if present we will validate whether the sent ID is a duplicate in our system or not.
|
89
|
+
attr_accessor :external_id
|
90
|
+
|
88
91
|
# The fields that have some problems and don't pass validation
|
89
92
|
attr_accessor :errors
|
90
93
|
|
@@ -137,6 +140,7 @@ module Bitpesa
|
|
137
140
|
:'metadata' => :'metadata',
|
138
141
|
:'state' => :'state',
|
139
142
|
:'id' => :'id',
|
143
|
+
:'external_id' => :'external_id',
|
140
144
|
:'errors' => :'errors'
|
141
145
|
}
|
142
146
|
end
|
@@ -168,6 +172,7 @@ module Bitpesa
|
|
168
172
|
:'metadata' => :'Object',
|
169
173
|
:'state' => :'SenderState',
|
170
174
|
:'id' => :'String',
|
175
|
+
:'external_id' => :'String',
|
171
176
|
:'errors' => :'Hash<String, Array<ValidationErrorDescription>>'
|
172
177
|
}
|
173
178
|
end
|
@@ -278,6 +283,10 @@ module Bitpesa
|
|
278
283
|
self.id = attributes[:'id']
|
279
284
|
end
|
280
285
|
|
286
|
+
if attributes.has_key?(:'external_id')
|
287
|
+
self.external_id = attributes[:'external_id']
|
288
|
+
end
|
289
|
+
|
281
290
|
if attributes.has_key?(:'errors')
|
282
291
|
if (value = attributes[:'errors']).is_a?(Hash)
|
283
292
|
self.errors = value
|
@@ -379,6 +388,7 @@ module Bitpesa
|
|
379
388
|
metadata == o.metadata &&
|
380
389
|
state == o.state &&
|
381
390
|
id == o.id &&
|
391
|
+
external_id == o.external_id &&
|
382
392
|
errors == o.errors
|
383
393
|
end
|
384
394
|
|
@@ -391,7 +401,7 @@ module Bitpesa
|
|
391
401
|
# Calculates hash code according to all attributes.
|
392
402
|
# @return [Fixnum] Hash code
|
393
403
|
def hash
|
394
|
-
[type, country, phone_country, phone_number, email, first_name, middle_name, last_name, occupation, nationality, onboarding_status, address, description, name, city, street, address_description, postal_code, birth_date, ip, documents, metadata, state, id, errors].hash
|
404
|
+
[type, country, phone_country, phone_number, email, first_name, middle_name, last_name, occupation, nationality, onboarding_status, address, description, name, city, street, address_description, postal_code, birth_date, ip, documents, metadata, state, id, external_id, errors].hash
|
395
405
|
end
|
396
406
|
|
397
407
|
require 'active_support/core_ext/hash'
|