Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update transaction model #22

Merged
merged 3 commits into from
Dec 11, 2015
Merged

Conversation

diogoguimaraes
Copy link
Contributor

This pull request updates the transaction model.

@diogoguimaraes diogoguimaraes self-assigned this Dec 3, 2015
@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from 1c49382 to 0deab81 Compare December 3, 2015 15:25
@diogoguimaraes diogoguimaraes removed the wip label Dec 3, 2015
@diogoguimaraes
Copy link
Contributor Author

R=@SandroMachado.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from 0deab81 to 59808cd Compare December 4, 2015 12:20
@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch 2 times, most recently from 8ccabd3 to 4119497 Compare December 7, 2015 15:41
@diogoguimaraes diogoguimaraes removed the wip label Dec 7, 2015
return Promise<Transaction>(error: UnexpectedResponseError(message: "Transaction id should not be nil."))
}

guard let origin = self.origin, cardId = origin.cardId else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to guard let cardId = self.origin?.cardId else. Our objective is to extract only the cardId, so we don't need to unwrap the origin to unwrap the cardId.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from 4119497 to a219658 Compare December 7, 2015 20:48
@diogoguimaraes
Copy link
Contributor Author

Updated @SandroMachado.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from a219658 to 5a5eaf5 Compare December 9, 2015 18:48
/**
Creates a transaction.

- parameter transactionRequest: The transaction request information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the documentation.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from 5a5eaf5 to 606c94e Compare December 10, 2015 11:28
@@ -115,20 +115,20 @@ class CardTest: UpholdTestCase {

card.createTransaction(transactionRequest).then { (transaction: Transaction) -> () in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add a test to the create transaction with commit query parameter.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from 606c94e to 736c412 Compare December 10, 2015 13:00
let request = UserCardService.createTransaction("bar", commit: true, transactionRequest: "foobar")

XCTAssertEqual(request.url, "https://api.uphold.com/v0/me/cards/bar/transactions", "Failed: Wrong URL.")
XCTAssertEqual(request.query[0], "commit=true", "Failed: Wrong URL.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an assert to the size of the query parameters.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from 736c412 to ead5eb0 Compare December 11, 2015 10:17
@diogoguimaraes
Copy link
Contributor Author

Updated @SandroMachado.

func testCreateTransactionWithCommitShouldReturnTheTransaction() {
let card: Card = Fixtures.loadCard(nil)
let expectation = expectationWithDescription("Card test: create transaction.")
card.adapter = MockRestAdapter(body: "{ \"id\": \"foobar\" }")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort.

@diogoguimaraes diogoguimaraes force-pushed the feature/update-transaction branch from ead5eb0 to be69a4e Compare December 11, 2015 10:57
SandroMachado added a commit that referenced this pull request Dec 11, 2015
@SandroMachado SandroMachado merged commit ed25d31 into master Dec 11, 2015
@SandroMachado SandroMachado deleted the feature/update-transaction branch December 11, 2015 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants