Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stripe-checkout
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
stripe-checkout
Commits
bfa0f89e
Commit
bfa0f89e
authored
4 months ago
by
geant-release-service
Browse files
Options
Downloads
Plain Diff
Finished release 0.8.
parents
f8d0ea7d
26a6c165
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
setup.py
+1
-1
1 addition, 1 deletion
setup.py
stripe_checkout/stripe_checkout/visit.py
+10
-0
10 additions, 0 deletions
stripe_checkout/stripe_checkout/visit.py
test/test_stripe.py
+14
-2
14 additions, 2 deletions
test/test_stripe.py
with
25 additions
and
3 deletions
setup.py
+
1
−
1
View file @
bfa0f89e
...
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup
(
name
=
"
stripe-checkout
"
,
version
=
"
0.
7
"
,
version
=
"
0.
8
"
,
author
=
"
GEANT
"
,
author_email
=
"
swd@geant.org
"
,
description
=
"
Stripe custom checkout support service
"
,
...
...
This diff is collapsed.
Click to expand it.
stripe_checkout/stripe_checkout/visit.py
+
10
−
0
View file @
bfa0f89e
...
...
@@ -88,8 +88,18 @@ class Visitor(dict):
return
addr
return
{}
@property
def
company
(
self
):
return
self
[
"
contact
"
].
get
(
"
company
"
,
""
)
@company.setter
def
company
(
self
,
value
):
self
[
"
contact
"
][
"
company
"
]
=
value
@property
def
organization
(
self
):
if
company
:
=
self
.
company
:
return
company
for
question
in
self
.
get
(
"
questions
"
,
[]):
if
question
[
"
id
"
]
==
VISIT_ORGANIZATION_QUESTION_ID
:
answers
=
question
[
"
answers
"
]
...
...
This diff is collapsed.
Click to expand it.
test/test_stripe.py
+
14
−
2
View file @
bfa0f89e
...
...
@@ -62,17 +62,29 @@ def test_adds_organization_to_billing_address(create_visitor, mock_stripe):
assert
full_result
[
"
line1
"
]
==
"
some_organization
"
def
test_adds_company_to_billing_address
(
create_visitor
,
mock_stripe
):
visitor
=
create_visitor
(
organization
=
"
some_organization
"
)
visitor
.
company
=
"
some_company
"
stripe
.
Customer
.
search
.
return_value
=
{
"
data
"
:
[]}
get_or_create_customer
(
visitor
)
assert
stripe
.
Customer
.
create
.
call_count
==
1
full_result
=
stripe
.
Customer
.
create
.
call_args
.
kwargs
[
"
address
"
]
assert
full_result
[
"
line1
"
]
==
"
some_company
"
def
test_updates_customer_metadata
(
create_visitor
,
mock_stripe
):
stripe
.
Customer
.
search
.
return_value
=
{
"
data
"
:
[{
"
id
"
:
"
stripe-cus-id
"
,
"
metadata
"
:
{
"
key
"
:
"
value
"
}}]
}
visitor
=
create_visitor
(
organization
=
"
some_organization
"
)
visitor
=
create_visitor
()
visitor
.
company
=
"
some_company
"
get_or_create_customer
(
visitor
)
metadata
=
stripe
.
Customer
.
modify
.
call_args
.
kwargs
[
"
metadata
"
]
assert
metadata
==
{
"
key
"
:
"
value
"
,
"
TNC25
"
:
"
yes
"
,
"
organization
"
:
"
some_
organization
"
,
"
organization
"
:
"
some_
company
"
,
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment