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

Core: option to create payments with REST API #342

Merged
merged 1 commit into from Mar 2, 2016

Conversation

tulimaki
Copy link
Contributor

@tulimaki tulimaki commented Feb 5, 2016

  • Add create_payment detail route to OrderViewSet
  • Add custom PaymentSerializer with amount_value,
    currency, payment_identifier and description as fields.

Refs SHOOP-2117 / SHOOP-1973

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1550/
Test PASSed.

@tulimaki tulimaki force-pushed the create_payment_api branch 2 times, most recently from aebfa31 to 8bd3362 Compare February 5, 2016 03:21
@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1551/
Test PASSed.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1552/
Test PASSed.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1553/
Test PASSed.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1554/
Test PASSed.

@akx
Copy link
Contributor

akx commented Feb 8, 2016

This should mention it's about the REST API, not just "API".

Also, it's missing tests.

@akx
Copy link
Contributor

akx commented Feb 8, 2016

Are payments currently retrievable via the API?

@Pikkupomo
Copy link
Contributor

like @akx said, add tests please

@tulimaki
Copy link
Contributor Author

tulimaki commented Feb 8, 2016

@akx payments are not currently retrievable via the REST API

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1560/
Test PASSed.

@tulimaki tulimaki changed the title Core: add API for creating payments Core: option to create payments with REST API Feb 8, 2016
@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1561/
Test PASSed.

data["payment_identifier"],
data.get("description", "")
)
return Response({'status': 'order is now fully paid'})
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a return code of 201 ("Created") would be more appropriate here?

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1564/
Test PASSed.

@akx
Copy link
Contributor

akx commented Feb 10, 2016

@tulimaki Now that you have a simple serializer for payments, it should be trivial to add something like payments = PaymentSerializer(many=True, read_only=True) to the OrderSerializer to make the payments accessible via the REST API.

@tulimaki
Copy link
Contributor Author

Payments is now available via REST API. Since Payment didn't have currency I added currency property for it. I guess that it's OK.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1566/
Test PASSed.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1570/
Test PASSed.

@tulimaki
Copy link
Contributor Author

tulimaki commented Mar 1, 2016

retest this please


@property
def currency(self):
return self.amount.currency
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of this? Why can't the API user just use payment.amount.currency (or payment.foreign_amount.currency)?

* Add create_payment detail route to OrderViewSet
* add set_fully_paid detail route to OrderViewSet
* Add PaymentSerializer with amount_value, payment_identifier
and description as fields.

Refs SHOOP-2117 / SHOOP-1973
@suutari-ai
Copy link
Contributor

This is cool now. Thanks, @tulimaki! :)

suutari-ai added a commit that referenced this pull request Mar 2, 2016
Core: option to create payments with REST API
@suutari-ai suutari-ai merged commit 3d49b5f into shuup:master Mar 2, 2016
@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1596/
Test FAILed.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1597/
Test FAILed.

@anders-jenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
http://spartacus.aintra:8080//job/shoop-ng-pull-requests/1599/
Test FAILed.

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.

None yet

5 participants