Skip to content

Commit 7beae0b

Browse files
authored
Merge pull request #5 from uphold/bugfix/add-destination-to-create-card-transaction
Add destination argument to createCardTransation action method
2 parents 12b5d5f + 25ee847 commit 7beae0b

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

docs/actions/card-transaction/create-card-transaction.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ The `commit` argument will add the `commit` query parameter.
1616

1717
The `body` argument accepts the following keys:
1818

19-
| Key | Type | Description |
20-
|:---------------|:-------|:-------------------------------------------------------------|
21-
| `amount` | String | The value amount to send in the denominated currency |
22-
| `currency` | String | The currency by which you wish to denominate the transaction |
23-
| `message` | String | Transaction details |
24-
| `securityCode` | String | Credit card security code |
19+
| Key | Type | Description |
20+
|:---------------|:-------|:------------------------------------------------------------------------------------------------------------------------------------------------------------|
21+
| `amount` | String | The value amount to send in the denominated currency |
22+
| `currency` | String | The currency by which you wish to denominate the transaction |
23+
| `destination` | String | The destination of the transaction, which can be in the form of a bitcoin address, an email address, an account id, an application id or an Uphold username |
24+
| `message` | String | Transaction details |
25+
| `securityCode` | String | Credit card security code |
2526

2627
This method returns a **Promise**.
2728

src/core/actions/card-transaction.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ export function commitCardTransaction(cardId, transactionId, { message, security
2828
}
2929

3030
// eslint-disable-next-line max-params
31-
export function createCardTransaction(cardId, { amount, currency, message, securityCode }, commit, otp, options) {
31+
export function createCardTransaction(cardId, { amount, currency, destination, message, securityCode }, commit, otp, options) {
3232
options = merge({
3333
body: {
3434
denomination: {
3535
amount,
3636
currency
3737
},
38+
destination,
3839
message,
3940
securityCode
4041
},

test/core/actions/card-transaction.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('CardTransactionActions', () => {
5555

5656
describe('createCardTransaction()', () => {
5757
it('should make a request to `POST /me/cards/:cardId/transactions`', () => {
58-
return sdk.createCardTransaction('bar', { amount: 'biz', currency: 'baz', message: 'buz', securityCode: 'bez' }, false, false, { qux: 'qix' })
58+
return sdk.createCardTransaction('bar', { amount: 'biz', currency: 'baz', destination: 'qax', message: 'buz', securityCode: 'bez' }, false, false, { qux: 'qix' })
5959
.then(result => {
6060
expect(result).toBe('foo');
6161
expect(sdk.api).toBeCalledWith('/me/cards/bar/transactions', {
@@ -64,6 +64,7 @@ describe('CardTransactionActions', () => {
6464
amount: 'biz',
6565
currency: 'baz'
6666
},
67+
destination: 'qax',
6768
message: 'buz',
6869
securityCode: 'bez'
6970
},
@@ -74,7 +75,7 @@ describe('CardTransactionActions', () => {
7475
});
7576

7677
it('should make a request to `POST /me/cards/:cardId/transactions` with commit query paramameter', () => {
77-
return sdk.createCardTransaction('bar', { amount: 'biz', currency: 'baz', message: 'buz', securityCode: 'bez' }, true, false, { queryParams: { qux: 'qix' } })
78+
return sdk.createCardTransaction('bar', { amount: 'biz', currency: 'baz', destination: 'qax', message: 'buz', securityCode: 'bez' }, true, false, { queryParams: { qux: 'qix' } })
7879
.then(result => {
7980
expect(result).toBe('foo');
8081
expect(sdk.api).toBeCalledWith('/me/cards/bar/transactions', {
@@ -83,6 +84,7 @@ describe('CardTransactionActions', () => {
8384
amount: 'biz',
8485
currency: 'baz'
8586
},
87+
destination: 'qax',
8688
message: 'buz',
8789
securityCode: 'bez'
8890
},

0 commit comments

Comments
 (0)