currency_cloud 0.10.0 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +55 -0
- data/HALL_OF_FAME.md +15 -0
- data/LICENSE.md +1 -1
- data/README.md +27 -1
- data/lib/currency_cloud/bank_details.rb +5 -0
- data/lib/currency_cloud/conversion.rb +25 -0
- data/lib/currency_cloud/conversion_cancellation_quote_result.rb +5 -0
- data/lib/currency_cloud/conversion_date_change_quote_result.rb +5 -0
- data/lib/currency_cloud/conversion_profit_and_loss.rb +5 -0
- data/lib/currency_cloud/conversion_report_result.rb +5 -0
- data/lib/currency_cloud/conversion_split_history_result.rb +5 -0
- data/lib/currency_cloud/conversion_split_preview_result.rb +5 -0
- data/lib/currency_cloud/find_report_requests_result.rb +5 -0
- data/lib/currency_cloud/payment.rb +10 -0
- data/lib/currency_cloud/payment_confirmation_result.rb +7 -0
- data/lib/currency_cloud/payment_delivery_date_result.rb +5 -0
- data/lib/currency_cloud/payment_report_result.rb +5 -0
- data/lib/currency_cloud/reference.rb +6 -0
- data/lib/currency_cloud/report_request_result.rb +5 -0
- data/lib/currency_cloud/reports.rb +28 -0
- data/lib/currency_cloud/sender.rb +8 -0
- data/lib/currency_cloud/sender_details_result.rb +7 -0
- data/lib/currency_cloud/transaction.rb +5 -0
- data/lib/currency_cloud/version.rb +1 -1
- data/spec/integration/conversions_spec.rb +120 -0
- data/spec/integration/payments_spec.rb +30 -0
- data/spec/integration/reference_spec.rb +18 -0
- data/spec/integration/reports_spec.rb +98 -0
- data/spec/integration/transactions_spec.rb +20 -0
- data/spec/support/vcr_cassettes/Conversions/can_cancel_conversion/with_notes/has_a_non-empty_notes_attribute.yml +3 -3
- data/spec/support/vcr_cassettes/Conversions/can_cancel_conversion/without_notes/has_a_empty_notes_attribute.yml +3 -3
- data/spec/support/vcr_cassettes/Conversions/can_cancellation_quote.yml +96 -0
- data/spec/support/vcr_cassettes/Conversions/can_date_change_conversion.yml +3 -3
- data/spec/support/vcr_cassettes/Conversions/can_retrieve_cancellation_quote.yml +88 -0
- data/spec/support/vcr_cassettes/Conversions/can_retrieve_date_change_quote.yml +88 -0
- data/spec/support/vcr_cassettes/Conversions/can_retrieve_profit_and_loss.yml +59 -0
- data/spec/support/vcr_cassettes/Conversions/can_split_conversion.yml +3 -3
- data/spec/support/vcr_cassettes/Conversions/can_split_history.yml +88 -0
- data/spec/support/vcr_cassettes/Conversions/can_split_preview.yml +88 -0
- data/spec/support/vcr_cassettes/IBANs/can_IBANs_for_a_specific_subaccount.yml +2 -2
- data/spec/support/vcr_cassettes/IBANs/can_IBANs_for_subaccounts.yml +2 -2
- data/spec/support/vcr_cassettes/IBANs/can_find.yml +2 -2
- data/spec/support/vcr_cassettes/Payments/can_authorise/when_payment_ids_are_valid.yml +5 -5
- data/spec/support/vcr_cassettes/Payments/can_create.yml +3 -3
- data/spec/support/vcr_cassettes/Payments/can_get_the_submission.yml +4 -4
- data/spec/support/vcr_cassettes/Payments/can_retrieve_confirmation.yml +88 -0
- data/spec/support/vcr_cassettes/Payments/can_retrieve_payment_delivery_date.yml +109 -0
- data/spec/support/vcr_cassettes/Reference/can_retrieve_bank_details.yml +101 -0
- data/spec/support/vcr_cassettes/Reference/can_retrieve_beneficiary_required_details.yml +2 -2
- data/spec/support/vcr_cassettes/Reference/can_retrieve_conversion_dates.yml +2 -2
- data/spec/support/vcr_cassettes/Reference/can_retrieve_currencies.yml +2 -2
- data/spec/support/vcr_cassettes/Reference/can_retrieve_payer_required_details.yml +2 -2
- data/spec/support/vcr_cassettes/Reference/can_retrieve_payment_dates.yml +2 -2
- data/spec/support/vcr_cassettes/Reference/can_retrieve_payment_purpose_codes.yml +2 -2
- data/spec/support/vcr_cassettes/Reference/can_retrieve_settlement_accounts.yml +2 -2
- data/spec/support/vcr_cassettes/Reports/can_create_conversions_report.yml +59 -0
- data/spec/support/vcr_cassettes/Reports/can_create_payments_report.yml +59 -0
- data/spec/support/vcr_cassettes/Reports/can_find_report_requests.yml +59 -0
- data/spec/support/vcr_cassettes/Reports/can_retrieve_report_request.yml +59 -0
- data/spec/support/vcr_cassettes/Settlements/can_add_conversion.yml +1 -1
- data/spec/support/vcr_cassettes/Settlements/can_release.yml +1 -1
- data/spec/support/vcr_cassettes/Settlements/can_remove_conversion.yml +1 -1
- data/spec/support/vcr_cassettes/Settlements/can_unrelease.yml +1 -1
- data/spec/support/vcr_cassettes/Transactions/can_retrieve_sender_details.yml +49 -0
- data/spec/support/vcr_cassettes/Transfers/can_create.yml +2 -2
- data/spec/support/vcr_cassettes/Transfers/can_find.yml +3 -3
- data/spec/support/vcr_cassettes/Transfers/can_retrieve.yml +3 -3
- data/spec/support/vcr_cassettes/VirtualAccounts/can_find.yml +2 -2
- data/spec/support/vcr_cassettes/VirtualAccounts/can_find_VANs_for_a_specific_subaccount.yml +2 -2
- data/spec/support/vcr_cassettes/VirtualAccounts/can_find_VANs_for_subaccounts.yml +2 -2
- metadata +70 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a3d86d137b05ff91df7c4347269163febf64ef026b7937aa85bfa1e5c005415a
|
4
|
+
data.tar.gz: d02b48b511db91cf9123b35db168d14bfba85d55a52b8b30342f6faf5b5bbc76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e703590da55833c1ae5a04f5ba8a8ab2abb243ae2d9d459023d8d2a2a03467ea4c0fc1f57c11a9f21be6ed54db0b3ca1e964d245b1fc1195762b0287a91db9c
|
7
|
+
data.tar.gz: ff6b0dc8a71a8236afaddf54700f935d27530f19db5d1b0634600c99967c945137e4688fd48fd5a8caa1c04cf08606fa53a1b62cd907dd269938a6466f1b5d68
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
### **We welcome pull requests from everyone!**
|
4
|
+
|
5
|
+
By making a contribution to this project, you certify that:
|
6
|
+
|
7
|
+
**(1)** The contribution was created in whole or in part by you and you have the right to submit it under the [MIT License (MIT)][MIT]; or
|
8
|
+
|
9
|
+
**(2)** The contribution is based upon previous work that, to the best of your knowledge, is covered under the MIT or an MIT compatible open source license and you have the right under that license to submit that work with modifications, whether created in whole or in part by you; or
|
10
|
+
|
11
|
+
**(3)** The contribution was provided directly to you by some other person who certified **(1)**, **(2)** or **(3)** and you have not modified it.
|
12
|
+
|
13
|
+
**(4)** You are not expected to provide support for the contribution, except to the extent you desire to provide support. You may provide support for free, for a fee, or not at all.
|
14
|
+
|
15
|
+
**(5)** You understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information you submit with it, including your sign-off)
|
16
|
+
is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
|
17
|
+
|
18
|
+
## Steps
|
19
|
+
**1. Fork, then clone the repo:**
|
20
|
+
```Shell
|
21
|
+
git clone git@github.com:your-username/currencycloud-ruby.git
|
22
|
+
```
|
23
|
+
|
24
|
+
**2. Work on your changes:**
|
25
|
+
- Make your change.
|
26
|
+
- Add tests for your change.
|
27
|
+
- Make commits of logical and atomic units.
|
28
|
+
- Check for unnecessary whitespace with `git diff --check` before committing.
|
29
|
+
- *nix users, verify file and directory permissions are 644 and 755 respectively before committing.
|
30
|
+
- Ensure your commit messages are clear, brief and to the point.
|
31
|
+
- If the commit fixes a bug, create an [issue][iss] and include the issue number in the commit message.
|
32
|
+
|
33
|
+
**3. Make sure ALL the tests pass:**
|
34
|
+
```Shell
|
35
|
+
bundle exec rspec
|
36
|
+
```
|
37
|
+
|
38
|
+
**4. Push to your fork and [submit a pull request][pr] across forks.**
|
39
|
+
|
40
|
+
**5. At this point you're waiting on us.** We like to at least comment on pull requests within a week, but sometimes we may take longer. We may suggest some changes, improvements or alternatives. We may decline your contribution but we will explain our reasons. In all cases, the maintainer's decision is final.
|
41
|
+
|
42
|
+
Some things that will increase the chance that your pull request is accepted, in karma order:
|
43
|
+
- changes that are cosmetic in nature, or do not add anything substantial to the stability, functionality, or testability of the SDK will generally not be accepted.
|
44
|
+
- add tests for your changes and ensure **all** tests pass. The first thing our maintainers check on every pull request is whether Travis has given the All-OK. If there are valid reasons why the tests cannot pass, make your case in the comments section.
|
45
|
+
- follow the SDK's code style. Start reading our code and you'll get the hang of it. We try to optimize for readability which in turn leads to maintainability.
|
46
|
+
- don't change the SDK's version number. Our maintainers will assign one upon commit.
|
47
|
+
- don't add your name to the build. Our maintainers will include you in our [Hall of Fame][hof] upon commit, unless you **explicitly** tell us not to.
|
48
|
+
|
49
|
+
## Acknowledgement
|
50
|
+
Our sincere thanks for helping us create the best API for moving money anywhere around the world!
|
51
|
+
|
52
|
+
[MIT]: LICENSE.md
|
53
|
+
[iss]: https://github.com/CurrencyCloud/currencycloud-ruby/issues
|
54
|
+
[pr]: https://github.com/CurrencyCloud/currencycloud-ruby/compare
|
55
|
+
[hof]: HALL_OF_FAME.md
|
data/HALL_OF_FAME.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Hall of Fame
|
2
|
+
### **Moving money shouldn’t be hard**
|
3
|
+
Here at [Currencycloud][ccy] we are totally committed to remove the complexity and red tape of international payments so that our customers can focus on delivering a great experience for their customers.
|
4
|
+
|
5
|
+
Just as it takes a village to raise a child, it takes a community of people volunteering their time, knowledge and skills to help us further develop our SDKs to levels of quality and usability that otherwise would be very difficult to achieve completely on our own.
|
6
|
+
|
7
|
+
Many people have helped us along the way and we are sincerely grateful to all of them but we would like to single out, and in a small way honour, the following individuals for their meaningful contributions (listed in alphabetical order):
|
8
|
+
|
9
|
+
|Name|Link/e-mail|
|
10
|
+
|--|--|
|
11
|
+
|
12
|
+
In our book, they have reached [**honorificabilitudinitatibus**][sesqui] :-)
|
13
|
+
|
14
|
+
[ccy]: https://www.currencycloud.com/
|
15
|
+
[sesqui]: https://en.wikipedia.org/wiki/Honorificabilitudinitatibus
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -130,6 +130,11 @@ error in any correspondence can be very helpful.
|
|
130
130
|
Test cases can be run with: `bundle exec rspec`. There is also a `Guardfile` that
|
131
131
|
is useful for continuously rerunning tests while you develop.
|
132
132
|
|
133
|
+
## Contributing
|
134
|
+
**We welcome pull requests from everyone!** Please see [CONTRIBUTING][contr]
|
135
|
+
|
136
|
+
Our sincere thanks for [helping us][hof] create the best API for moving money anywhere around the world!
|
137
|
+
|
133
138
|
## Dependencies
|
134
139
|
|
135
140
|
* [HTTParty][httparty]
|
@@ -141,9 +146,28 @@ This project uses [semantic versioning][semver]. You can safely
|
|
141
146
|
express a dependency on a major version and expect all minor and patch versions
|
142
147
|
to be backwards compatible.
|
143
148
|
|
149
|
+
## Deprecation Policy
|
150
|
+
Technology evolves quickly and we are always looking for better ways to serve our customers. From time to time we need to make room for innovation by removing sections of code that are no longer necessary. We understand this can be disruptive and consequently we have designed a Deprecation Policy that protects our customers' investment and that allows us to take advantage of modern tools, frameworks and practices in developing software.
|
151
|
+
|
152
|
+
Deprecation means that we discourage the use of a feature, design or practice because it has been superseded or is no longer considered efficient or safe but instead of removing it immediately, we mark it as **@deprecated** to provide backwards compatibility and time for you to update your projects. While the deprecated feature remains in the SDK for a period of time, we advise that you replace it with the recommended alternative which is explained in the relevant section of the code.
|
153
|
+
|
154
|
+
We remove deprecated features after **three months** from the time of announcement.
|
155
|
+
|
156
|
+
The security of our customers' assets is of paramount importance to us and sometimes we have to deprecate features because they may pose a security threat or because new, more secure, ways are available. On such occasions we reserve the right to set a different deprecation period which may range from **immediate removal** to the standard **three months**.
|
157
|
+
|
158
|
+
Once a feature has been marked as deprecated, we no longer develop the code or implement bug fixes. We only do security fixes.
|
159
|
+
|
160
|
+
### List of features being deprecated
|
161
|
+
```
|
162
|
+
(No features are currently being deprecated)
|
163
|
+
```
|
164
|
+
|
165
|
+
# Support
|
166
|
+
We actively support the latest version of the SDK. We support the immediate previous version on best-efforts basis. All other versions are no longer supported nor maintained.
|
167
|
+
|
144
168
|
# Copyright
|
145
169
|
|
146
|
-
Copyright (c) 2016 Currencycloud. See [LICENSE][license] for details.
|
170
|
+
Copyright (c) 2016-2019 Currencycloud. See [LICENSE][license] for details.
|
147
171
|
|
148
172
|
[developer]: https://developer.currencycloud.com/documentation/getting-started/introduction/
|
149
173
|
[travis]: https://travis-ci.org/CurrencyCloud/currencycloud-ruby
|
@@ -153,3 +177,5 @@ Copyright (c) 2016 Currencycloud. See [LICENSE][license] for details.
|
|
153
177
|
[json]: https://github.com/intridea/multi_json
|
154
178
|
[semver]: http://semver.org/
|
155
179
|
[license]: LICENSE.md
|
180
|
+
[contr]: CONTRIBUTING.md
|
181
|
+
[hof]: HALL_OF_FAME.md
|
@@ -19,5 +19,30 @@ module CurrencyCloud
|
|
19
19
|
attrs = client.post("#{id}/split", params)
|
20
20
|
ConversionSplitResult.new(attrs)
|
21
21
|
end
|
22
|
+
|
23
|
+
def self.retrieve_profit_and_loss(params = {})
|
24
|
+
attrs = client.get("profit_and_loss", params)
|
25
|
+
ConversionProfitAndLoss.new(attrs)
|
26
|
+
end
|
27
|
+
|
28
|
+
def date_change_quote(params)
|
29
|
+
attrs = client.get("#{id}/date_change_quote", params)
|
30
|
+
ConversionDateChangeQuoteResult.new(attrs)
|
31
|
+
end
|
32
|
+
|
33
|
+
def split_preview(params)
|
34
|
+
attrs = client.get("#{id}/split_preview", params)
|
35
|
+
ConversionSplitPreviewResult.new(attrs)
|
36
|
+
end
|
37
|
+
|
38
|
+
def split_history
|
39
|
+
attrs = client.get("#{id}/split_history")
|
40
|
+
ConversionSplitHistoryResult.new(attrs)
|
41
|
+
end
|
42
|
+
|
43
|
+
def cancellation_quote
|
44
|
+
attrs = client.get("#{id}/cancellation_quote")
|
45
|
+
ConversionCancellationQuoteResult.new(attrs)
|
46
|
+
end
|
22
47
|
end
|
23
48
|
end
|
@@ -14,5 +14,15 @@ module CurrencyCloud
|
|
14
14
|
result = client.post("authorise", payment_ids: ids)['authorisations']
|
15
15
|
result.map { |pa| PaymentAuthorisationResult.new(pa) }
|
16
16
|
end
|
17
|
+
|
18
|
+
def confirmation(params = {})
|
19
|
+
result = client.get("#{id}/confirmation", params)
|
20
|
+
PaymentConfirmationResult.new(result)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.payment_delivery_date(params)
|
24
|
+
result = client.get("payment_delivery_date", params)
|
25
|
+
PaymentDeliveryDateResult.new(result)
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
@@ -37,5 +37,11 @@ module CurrencyCloud
|
|
37
37
|
response = client.get('settlement_accounts', params)
|
38
38
|
response['settlement_accounts'].map { |s| SettlementAccount.new(s) }
|
39
39
|
end
|
40
|
+
|
41
|
+
def self.bank_details(params = {})
|
42
|
+
bank_details = client.get('bank_details', params)
|
43
|
+
BankDetails.new(bank_details)
|
44
|
+
end
|
45
|
+
|
40
46
|
end
|
41
47
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module CurrencyCloud
|
2
|
+
class Reports
|
3
|
+
include CurrencyCloud::Resource
|
4
|
+
|
5
|
+
resource :reports
|
6
|
+
actions :create, :retrieve
|
7
|
+
|
8
|
+
def self.create_conversions_report(params = {})
|
9
|
+
response = client.post('conversions/create', params)
|
10
|
+
ConversionReportResult.new(response)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.create_payments_report(params = {})
|
14
|
+
response = client.post('payments/create', params)
|
15
|
+
PaymentReportResult.new(response)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.find_report_requests(params = {})
|
19
|
+
response = client.get('report_requests/find', params)
|
20
|
+
FindReportRequestsResult.new(response)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.retrieve_report_request(report_id, params = {})
|
24
|
+
response = client.get("report_requests/#{report_id}", params)
|
25
|
+
ReportRequestResult.new(response)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -91,4 +91,124 @@ describe 'Conversions', vcr: true do
|
|
91
91
|
expect(split_conversion.child_conversion['conversion_date']).to eq('2018-07-18T00:00:00+00:00')
|
92
92
|
expect(split_conversion.child_conversion['status']).to eq('awaiting_funds')
|
93
93
|
end
|
94
|
+
|
95
|
+
it 'can #retrieve_profit_and_loss' do
|
96
|
+
profit_and_loss = CurrencyCloud::Conversion.retrieve_profit_and_loss()
|
97
|
+
|
98
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['account_id']).to eq('72970a7c-7921-431c-b95f-3438724ba16f')
|
99
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['contact_id']).to eq('a66ca63f-e668-47af-8bb9-74363240d781')
|
100
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['event_account_id']).to eq(nil)
|
101
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['event_contact_id']).to eq(nil)
|
102
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['conversion_id']).to eq('515eaa18-0756-42b9-9899-49bfea5d3e8a')
|
103
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['event_type']).to eq('self_service_cancellation')
|
104
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['amount']).to eq('-0.01')
|
105
|
+
expect(profit_and_loss.conversion_profit_and_losses[0]['currency']).to eq('GBP')
|
106
|
+
|
107
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['account_id']).to eq('72970a7c-7921-431c-b95f-3438724ba16f')
|
108
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['contact_id']).to eq('a66ca63f-e668-47af-8bb9-74363240d781')
|
109
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['event_account_id']).to eq(nil)
|
110
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['event_contact_id']).to eq(nil)
|
111
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['conversion_id']).to eq('10c79aba-a9ee-41c2-b0ce-89a0941a8599')
|
112
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['event_type']).to eq('self_service_cancellation')
|
113
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['amount']).to eq('-0.01')
|
114
|
+
expect(profit_and_loss.conversion_profit_and_losses[1]['currency']).to eq('GBP')
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'can retrieve #date_change_quote' do
|
118
|
+
new_settlement_date = '2018-11-29'
|
119
|
+
conversion = CurrencyCloud::Conversion.create(conversion_params)
|
120
|
+
|
121
|
+
date_change_quote = conversion.date_change_quote(new_settlement_date: new_settlement_date)
|
122
|
+
|
123
|
+
expect(date_change_quote.conversion_id).to eq('d391e0a1-2643-44ff-b063-bbe39c98a2b5')
|
124
|
+
expect(date_change_quote.amount).to eq('-0.01')
|
125
|
+
expect(date_change_quote.currency).to eq('GBP')
|
126
|
+
expect(date_change_quote.new_conversion_date).to eq('2018-11-20T00:00:00+00:00')
|
127
|
+
expect(date_change_quote.new_settlement_date).to eq('2018-11-20T16:30:00+00:00')
|
128
|
+
expect(date_change_quote.old_conversion_date).to eq('2018-11-19T00:00:00+00:00')
|
129
|
+
expect(date_change_quote.old_settlement_date).to eq('2018-11-19T16:30:00+00:00')
|
130
|
+
expect(date_change_quote.event_date_time).to eq('2018-11-15T14:08:01+00:00')
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'can #split_preview' do
|
134
|
+
conversion = CurrencyCloud::Conversion.create(conversion_params)
|
135
|
+
|
136
|
+
split_preview = conversion.split_preview(amount: 100)
|
137
|
+
|
138
|
+
expect(split_preview.parent_conversion['id']).to eq('b401a1bc-ba02-4bd6-920e-8bf6fd97282b')
|
139
|
+
expect(split_preview.parent_conversion['short_reference']).to eq('20180622-XCRNWB')
|
140
|
+
expect(split_preview.parent_conversion['sell_amount']).to eq('70.93')
|
141
|
+
expect(split_preview.parent_conversion['sell_currency']).to eq('GBP')
|
142
|
+
expect(split_preview.parent_conversion['buy_amount']).to eq('100.00')
|
143
|
+
expect(split_preview.parent_conversion['buy_currency']).to eq('USD')
|
144
|
+
expect(split_preview.parent_conversion['settlement_date']).to eq('2018-07-02T15:30:00+00:00')
|
145
|
+
expect(split_preview.parent_conversion['conversion_date']).to eq('2018-07-02T00:00:00+00:00')
|
146
|
+
expect(split_preview.parent_conversion['status']).to eq('awaiting_funds')
|
147
|
+
|
148
|
+
expect(split_preview.child_conversion['id']).to eq('13575890-f1a3-466d-81ce-f9444d2816a7')
|
149
|
+
expect(split_preview.child_conversion['short_reference']).to eq('20180622-GXWQPV')
|
150
|
+
expect(split_preview.child_conversion['sell_amount']).to eq('35.46')
|
151
|
+
expect(split_preview.child_conversion['sell_currency']).to eq('GBP')
|
152
|
+
expect(split_preview.child_conversion['buy_amount']).to eq('50.00')
|
153
|
+
expect(split_preview.child_conversion['buy_currency']).to eq('USD')
|
154
|
+
expect(split_preview.child_conversion['settlement_date']).to eq('2018-07-02T15:30:00+00:00')
|
155
|
+
expect(split_preview.child_conversion['conversion_date']).to eq('2018-07-02T00:00:00+00:00')
|
156
|
+
expect(split_preview.child_conversion['status']).to eq('awaiting_funds')
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'can #split_history' do
|
160
|
+
conversion = CurrencyCloud::Conversion.create(conversion_params)
|
161
|
+
|
162
|
+
split_history = conversion.split_history
|
163
|
+
|
164
|
+
expect(split_history.parent_conversion['id']).to eq('24d2ee7f-c7a3-4181-979e-9c58dbace992')
|
165
|
+
expect(split_history.parent_conversion['short_reference']).to eq('20180716-XMXMMS')
|
166
|
+
expect(split_history.parent_conversion['sell_amount']).to eq('2417.10')
|
167
|
+
expect(split_history.parent_conversion['sell_currency']).to eq('GBP')
|
168
|
+
expect(split_history.parent_conversion['buy_amount']).to eq('3000.00')
|
169
|
+
expect(split_history.parent_conversion['buy_currency']).to eq('EUR')
|
170
|
+
expect(split_history.parent_conversion['settlement_date']).to eq('2018-06-28T13:00:00+00:00')
|
171
|
+
expect(split_history.parent_conversion['conversion_date']).to eq('2018-06-28T00:00:00+00:00')
|
172
|
+
expect(split_history.parent_conversion['status']).to eq('awaiting_funds')
|
173
|
+
|
174
|
+
expect(split_history.origin_conversion['id']).to eq('9d7919b5-c72d-41e1-9745-d2d5dc35e338')
|
175
|
+
expect(split_history.origin_conversion['short_reference']).to eq('20180626-YVRVTT')
|
176
|
+
expect(split_history.origin_conversion['sell_amount']).to eq('3222.80')
|
177
|
+
expect(split_history.origin_conversion['sell_currency']).to eq('GBP')
|
178
|
+
expect(split_history.origin_conversion['buy_amount']).to eq('4000.00')
|
179
|
+
expect(split_history.origin_conversion['buy_currency']).to eq('EUR')
|
180
|
+
expect(split_history.origin_conversion['settlement_date']).to eq('2018-06-28T13:00:00+00:00')
|
181
|
+
expect(split_history.origin_conversion['conversion_date']).to eq('2018-06-28T00:00:00+00:00')
|
182
|
+
expect(split_history.origin_conversion['status']).to eq('awaiting_funds')
|
183
|
+
|
184
|
+
expect(split_history.child_conversions[0]['id']).to eq('c8a323d8-7366-4bf3-b7c5-a6590e07eda3')
|
185
|
+
expect(split_history.child_conversions[0]['short_reference']).to eq('20180716-KWQYDK')
|
186
|
+
expect(split_history.child_conversions[0]['sell_amount']).to eq('1208.55')
|
187
|
+
expect(split_history.child_conversions[0]['sell_currency']).to eq('GBP')
|
188
|
+
expect(split_history.child_conversions[0]['buy_amount']).to eq('1500.00')
|
189
|
+
expect(split_history.child_conversions[0]['buy_currency']).to eq('EUR')
|
190
|
+
expect(split_history.child_conversions[0]['settlement_date']).to eq('2018-06-28T13:00:00+00:00')
|
191
|
+
expect(split_history.child_conversions[0]['conversion_date']).to eq('2018-06-28T00:00:00+00:00')
|
192
|
+
expect(split_history.child_conversions[0]['status']).to eq('awaiting_funds')
|
193
|
+
|
194
|
+
expect(split_history.child_conversions[1]['id']).to eq('615227c4-a955-4a6c-a415-68accc3ae47f')
|
195
|
+
expect(split_history.child_conversions[1]['short_reference']).to eq('20180716-EARWAY')
|
196
|
+
expect(split_history.child_conversions[1]['sell_amount']).to eq('1208.55')
|
197
|
+
expect(split_history.child_conversions[1]['sell_currency']).to eq('GBP')
|
198
|
+
expect(split_history.child_conversions[1]['buy_amount']).to eq('1500.00')
|
199
|
+
expect(split_history.child_conversions[1]['buy_currency']).to eq('EUR')
|
200
|
+
expect(split_history.child_conversions[1]['settlement_date']).to eq('2018-06-28T13:00:00+00:00')
|
201
|
+
expect(split_history.child_conversions[1]['conversion_date']).to eq('2018-06-28T00:00:00+00:00')
|
202
|
+
expect(split_history.child_conversions[1]['status']).to eq('awaiting_funds')
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'can retrieve #cancellation_quote' do
|
206
|
+
conversion = CurrencyCloud::Conversion.create(conversion_params)
|
207
|
+
|
208
|
+
cancellation_quote = conversion.cancellation_quote
|
209
|
+
|
210
|
+
expect(cancellation_quote.amount).to eq('-0.01')
|
211
|
+
expect(cancellation_quote.currency).to eq('GBP')
|
212
|
+
expect(cancellation_quote.event_date_time).to eq('2018-11-15T14:08:07+00:00')
|
213
|
+
end
|
94
214
|
end
|