Skip to content

Commit

Permalink
change to dima test org
Browse files Browse the repository at this point in the history
  • Loading branch information
bphillips-99 committed Apr 16, 2024
1 parent d20a059 commit c8aaddf
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 386 deletions.
191 changes: 191 additions & 0 deletions tntyc17ae1g.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
data:
- attributes:
created_at: '2024-01-11T16:43:44'
destination_override_endpoint: '*'
entries:
- classifiers: {}
config:
condition: AND
expression: null
rules:
- condition: null
expression:
field: PathInfo
operator: begins_with
type: string
values:
- /network-tokens
rules: null
- condition: null
expression:
field: Method
operator: equals
type: string
values:
- POST
rules: null
id: 63442e56-6917-4a12-b6d0-5dc484c64d47
id_selector: null
operation: ENRICH
operations:
- name: github.com/verygoodsecurity/common/compute/larky/http/Process
parameters:
script: |
load("@stdlib//json", json="json")
load("@stdlib//builtins", builtins="builtins")
load("@vgs//vault", "vault")
def process(input, ctx):
body = json.loads(str(input.body))
input.headers['Calm-Tenant'] = ctx['tenant-id-key']
if "pan_alias" in body:
body["pan"] = vault.reveal(body["pan_alias"])
if "cvv_alias" in body:
body["cvv"] = vault.reveal(body["cvv_alias"])
body.pop("cvv_alias")
input.body = builtins.bytes(json.dumps(body))
return input
phase: REQUEST
public_token_generator: ALPHANUMERIC_SIX_T_FOUR
targets:
- body
token_manager: PERSISTENT
transformer: JSON_PATH
transformer_config:
- $.account_number
transformer_config_map: null
host_endpoint: calm\.sandbox\.verygoodsecurity\.app
id: d5e6d6b8-90ab-4112-944b-60688167c82a
ordinal: null
port: 80
protocol: http
source_endpoint: '*'
tags:
integration: network-tokens-api--default
name: network-tokens-api outbound
source: IntegrationTemplates
updated_at: '2024-01-11T16:43:44'
id: d5e6d6b8-90ab-4112-944b-60688167c82a
type: rule_chain
- attributes:
created_at: '2024-02-07T15:39:54'
destination_override_endpoint: 'https://api.sandbox.verygoodvault.com'
entries: []
host_endpoint: 'tnt[a-z0-9]+-[a-z0-9-]+.[A-Za-z0-9-]\.sandbox\.verygoodproxy\.com'
id: 722a830b-c412-42eb-a66e-ad25011010e8
ordinal: null
port: 80
protocol: http
source_endpoint: '*'
tags:
name: orange-hexagon
source: tokenizationCollect
updated_at: '2024-02-07T15:39:54'
id: 722a830b-c412-42eb-a66e-ad25011010e8
type: rule_chain
- attributes:
created_at: '2024-02-07T15:41:36'
destination_override_endpoint: '*'
entries:
- classifiers: {}
config:
condition: AND
expression: null
rules:
- condition: null
expression:
field: PathInfo
operator: matches
type: string
values:
- /mock-psp/payments/success
rules: null
id: 8b26866e-cf53-4ba1-8441-64b320d1242a
id_selector: null
operation: ENRICH
operations:
- name: github.com/verygoodsecurity/common/compute/larky/http/Process
parameters:
script: >-
load("@stdlib//builtins", "builtins")
load("@stdlib//json", "json")
load("@vendor//option/result", safe="safe")
load("@vgs//nts", "nts")
load("@vgs//vault", vault="vault")
# Wrap the network token render function in the safe decorator
to capture
# network token errors so that it will return a result object
instead of
# failing the whole request.
safe_render = safe(nts.render)
def process(input, ctx):
# Parse JSON-encoded body data of request
body = json.loads(str(input.body))
# Render network token into the body payload
result = safe_render(
body,
pan="$.paymentMethod.number",
cvv="$.paymentMethod.cvc",
amount="$.amount.value",
currency_code="$.amount.currency",
exp_month="$.paymentMethod.expiryMonth",
exp_year="$.paymentMethod.expiryYear",
cryptogram_value="$.mpiData.cavv",
cryptogram_eci="$.mpiData.eci",
)
if result != None and result.is_ok:
input.headers['provisioned_NT'] = True
# We got the network token and ran render successfully, let's use it here
body = result.unwrap()
if int(body["paymentMethod"]["expiryYear"]) < 100:
# The expiry year we got from network token could be two digits,
# let's convert it to four digits if it's the case here
body["paymentMethod"]["expiryYear"] = 2000 + int(body["paymentMethod"]["expiryYear"])
body["paymentMethod"]["type"]="networkToken"
body["paymentMethod"]["brand"]="mc"
else:
input.headers['provisioned_NT'] = False
# Fallback to PAN/CVV - either we didn't call render or render failed
body["paymentMethod"]["type"] = "scheme"
body["paymentMethod"]["number"] = vault.reveal(body["paymentMethod"]["number"])
# Reveal CVC value if available
if "cvc" in body["paymentMethod"]:
raw_cvc=vault.reveal(body["paymentMethod"]["cvc"], storage="volatile")
if raw_cvc != body["paymentMethod"]["cvc"]:
body["paymentMethod"]["cvc"] = raw_cvc
# Convert body object back to JSON-encoded data
input.body = builtins.bytes(json.dumps(body))
return input
phase: REQUEST
public_token_generator: UUID
targets:
- body
token_manager: PERSISTENT
transformer: JSON_PATH
transformer_config:
- $.account_number
transformer_config_map: null
host_endpoint: 'https://dashboard-service.apps.verygoodsecurity.com'
id: 5ae78341-045a-491c-8e41-a3c6d270e088
ordinal: null
port: 80
protocol: http
source_endpoint: '*'
tags:
name: PSP Configuration
source: RouteContainer
updated_at: '2024-02-07T15:41:36'
id: 5ae78341-045a-491c-8e41-a3c6d270e088
type: rule_chain
version: 1
Loading

0 comments on commit c8aaddf

Please sign in to comment.