{
  "info": {
    "_postman_id": "d1ddc970-6010-410a-a0bf-d68070558fce",
    "name": "OpenAPI",
    "description": "Коллекция запросов для работы с OpenAPI Точки",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "23855216"
  },
  "item": [
    {
      "name": "Разрешения",
      "item": [
        {
          "name": "Проверка всех разрешений",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/consent/v1.0/consents",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "consent",
                "v1.0",
                "consents"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Проверяем разрешение",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/consent/v1.0/consents/{{consent_id}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "consent",
                "v1.0",
                "consents",
                "{{consent_id}}"
              ]
            },
            "description": "Запрос для проверки статуса разрешения"
          },
          "response": []
        },
        {
          "name": "Проверяем дочерние разрешения",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/consent/v1.0/consents/{{consent_id}}/child",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "consent",
                "v1.0",
                "consents",
                "{{consent_id}}",
                "child"
              ]
            },
            "description": "Запрос для проверки статуса разрешения"
          },
          "response": []
        },
        {
					"name": "Создаем разрешение",
					"request": {
						"auth": {
							"type": "bearer",
							"bearer": [
								{
									"key": "token",
									"value": "{{accesstoken_hybrid}}",
									"type": "string"
								}
							]
						},
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"Data\": {\n        \"status\": \"AwaitingAuthorisation\",\n        \"creationDateTime\": \"2019-01-01T06:06:06.364+00:00\",\n        \"statusUpdateDateTime\": \"2019-01-01T06:06:06.364+00:00\",\n        \"permissions\": [\n            \"ReadAccountsBasic\"\n        ],\n        \"expirationDateTime\": \"2019-01-01T06:06:06.364+00:00\"\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{RS_URL}}/consent/v1.0/consents",
							"host": [
								"{{RS_URL}}"
							],
							"path": [
								"consent",
								"v1.0",
								"consents"
							]
						}
					},
					"response": []
				}
      ]
    },
    {
      "name": "СБП",
      "item": [
        {
          "name": "1. Сервис СБП: Работа с ЮЛ",
          "item": [
            {
              "name": "Register Legal Entity",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
											"pm.test(\"Response Legal Id\", function(){",
											"    const responseText = pm.response.text();",
											"    pm.expect(responseText).to.include(\"legalId\");",
											"",
											"    const jsonData = JSON.parse(responseText);",
											"",
											"    pm.environment.set(\"legalId\", jsonData.Data.legalId);",
											"});",
											""
										],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"bankCode\": \"{{bankCode}}\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/register-sbp-legal-entity",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "register-sbp-legal-entity"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Set legal entity status",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"status\": \"Active\",\n        \"legalId\": \"{{legalId}}\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/legal-entity/{{legalId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "legal-entity",
                    "{{legalId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Legal Entity",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/legal-entity/{{legalId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "legal-entity",
                    "{{legalId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Customer Info",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "{{access_token_v2}}",
                    "disabled": true
                  }
                ],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/customer/{{customerCode}}/{{bankCode}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "customer",
                    "{{customerCode}}",
                    "{{bankCode}}"
                  ]
                },
                "description": "Возвращает информацию о расчетном счете юр. лица."
              },
              "response": []
            },
            {
              "name": "Get Accounts List",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/account/{{legalId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "account",
                    "{{legalId}}"
                  ]
                },
                "description": "Возвращает список счетов юр. лица."
              },
              "response": []
            }
          ]
        },
        {
          "name": "2. Сервис СБП: Работа с ТСП",
          "item": [
            {
              "name": "Register Merchant",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
											"pm.test(\"Response Merchant Id\", function(){",
											"    const responseText = pm.response.text();",
											"    pm.expect(responseText).to.include(\"merchantId\");",
											"",
											"    const jsonData = JSON.parse(responseText);",
											"",
											"    pm.environment.set(\"merchantId\", jsonData.Data.merchantId);",
											"});",
											""
										],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [
                  {
                    "key": "",
                    "value": ""
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"legalId\": \"{{legalId}}\",\n        \"address\": \"Адрес торговой точки\",\n        \"city\": \"Город где находится торговая точка\",\n        \"countryCode\": \"RU\",\n        \"countrySubDivisionCode\": \"Первые две цифры ОКТМО\",\n        \"zipCode\": \"Индекс\",\n        \"brandName\": \"Название торговой точки\",\n        \"capabilities\": \"111\",\n        \"contactPhoneNumber\": \"Контактный номер телефона\",\n        \"mcc\": \"МСС-код\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/merchant/legal-entity/{{legalId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "merchant",
                    "legal-entity",
                    "{{legalId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Set Merchant Status",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "PUT",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"status\": \"Active\",\n        \"legalId\": \"{{legalId}}\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/merchant/{{merchantId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "merchant",
                    "{{merchantId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Merchant",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/merchant/{{merchantId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "merchant",
                    "{{merchantId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Merchants List",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/merchant/legal-entity/{{legalId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "merchant",
                    "legal-entity",
                    "{{legalId}}"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "3. Сервис СБП: Работа с QR-кодами",
          "item": [
            {
              "name": "Register Qr Code",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
											"pm.test(\"Response qrcId\", function(){",
											"    const responseText = pm.response.text();",
											"    pm.expect(responseText).to.include(\"qrcId\");",
											"",
											"    const jsonData = JSON.parse(responseText);",
											"",
											"    pm.environment.set(\"qrcId\", jsonData.Data.qrcId);",
											"});",
											""
										],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"merchantId\": \"{{merchantId}}\",\n        \"legalId\": \"{{legalId}}\",\n        \"customerCode\": \"{{customerCode}}\",\n        \"amount\": 1,\n        \"currency\": \"RUB\",\n        \"paymentPurpose\": \"Bill\",\n        \"qrcType\": \"01\",\n        \"imageParams\": {\n            \"width\": 200,\n            \"height\": 200,\n            \"mediaType\": \"image/png\"\n        },\n        \"sourceName\": \"string\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/qr-code/merchant/{{merchantId}}/{{accountId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "qr-code",
                    "merchant",
                    "{{merchantId}}",
                    "{{accountId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Qr Code",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/qr-code/{{qrcId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "qr-code",
                    "{{qrcId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Qr Code Payment Status",
              "protocolProfileBehavior": {
                "disableBodyPruning": true
              },
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/qr-codes/{{qrcId}}/payment-status",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "qr-codes",
                    "{{qrcId}}",
                    "payment-status"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Qr Codes List",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/qr-code/legal-entity/{{legalId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "qr-code",
                    "legal-entity",
                    "{{legalId}}"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "4. Сервис СБП: Работа с возвратами",
          "item": [
            {
              "name": "Start Refund",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
											"pm.test(\"Response Refund Id\", function(){",
											"    const responseText = pm.response.text();",
											"    pm.expect(responseText).to.include(\"requestId\");",
											"",
											"    const jsonData = JSON.parse(responseText);",
											"",
											"    pm.environment.set(\"refund_id\", jsonData.Data.requestId);",
											"});",
											""
										],
                    "type": "text/javascript"
                  }
                }
              ],
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"bankCode\": \"000000000\",\n        \"accountCode\": \"00000000000000000000\",\n        \"amount\": 0.01,\n        \"currency\": \"RUB\",\n        \"purpose\": \"Возврат невыясненных ндс\",\n        \"refTransactionId\": \"trx-id-uuid\",\n        \"qrcId\": \"{{qrcId}}\",\n        \"trxId\": \"trx-id\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/refund",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "refund"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Refund Status",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "protocolProfileBehavior": {
                "disableBodyPruning": true
              },
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/refund/{{refund_id}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "refund",
                    "{{refund_id}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get payments",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      ""
                    ],
                    "type": "text/javascript"
                  }
                }
              ],
              "protocolProfileBehavior": {
                "disableBodyPruning": true
              },
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/get-sbp-payments?customerCode={{customerCode}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "get-sbp-payments"
                  ],
                  "query": [
                    {
                      "key": "customerCode",
                      "value": "{{customerCode}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "5. Сервис СБП: Работа с кассовыми QR-кодами",
          "item": [
            {
              "name": "Register Cashbox Qrcode",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"merchantId\": \"{{merchantId}}\",\n        \"accountId\": \"{{accountId}}\",\n        \"redirectUrl\": \"\",\n        \"imageParams\": {\n            \"width\": 200,\n            \"height\": 200,\n            \"mediaType\": \"image/png\"\n        }\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Cashbox Qrcode",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"imageParams\": {\n            \"width\": 200,\n            \"height\": 200,\n            \"mediaType\": \"image/png\"\n        }\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/{{qrcId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "{{qrcId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Cashbox Qrcode List",
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/merchant/{{merchantId}}/{{accountId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "merchant",
                    "{{merchantId}}",
                    "{{accountId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Change Cashbox Qrcode Account",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"accountId\": \"{{accountId}}\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/{{qrcId}}/account",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "{{qrcId}}",
                    "account"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Activate Cashbox Qrcode",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"amount\": 10000,\n        \"currency\": \"RUB\",\n        \"paymentPurpose\": \"\",\n        \"ttl\": 5\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/{{qrcId}}/activate",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "{{qrcId}}",
                    "activate"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Deactivate Cashbox Qrcode",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/{{qrcId}}/deactivate",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "{{qrcId}}",
                    "deactivate"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Cashbox Qrcode Operation Status",
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/{{qrcId}}/operation?paramsId=AP10001G1HPSOI658DP9SJK41V7JEDRS",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "{{qrcId}}",
                    "operation"
                  ],
                  "query": [
                    {
                      "key": "paramsId",
                      "value": "AP10001G1HPSOI658DP9SJK41V7JEDRS"
                    }
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get Cashbox Qrcode Status",
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "Authorization",
                    "value": "Bearer {{accesstoken_hybrid}}"
                  }
                ],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/cashbox-qr-code/{{qrcId}}/status",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "cashbox-qr-code",
                    "{{qrcId}}",
                    "status"
                  ]
                }
              },
              "response": []
            }
          ]
        },
        {
          "name": "6. Сервис СБП: работа с B2B QR-кодами",
          "item": [
            {
              "name": "Register B2B Qrcode",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "{\n    \"Data\": {\n        \"amount\": 100,\n        \"paymentPurpose\": \"Bill\",\n        \"sourceName\": \"string\",\n        \"takeTax\": true,\n        \"totalTaxAmount\": 10,\n        \"ttl\": 100,\n        \"redirectUrl\": \"\",\n        \"uip\": \"\"\n    }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/b2b-qr-code/merchant/{{merchantId}}/{{accountId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "b2b-qr-code",
                    "merchant",
                    "{{merchantId}}",
                    "{{accountId}}"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "Get B2B Qrcode",
              "request": {
                "auth": {
                  "type": "bearer",
                  "bearer": [
                    {
                      "key": "token",
                      "value": "{{accesstoken_hybrid}}",
                      "type": "string"
                    }
                  ]
                },
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{RS_URL}}/sbp/v1.0/b2b-qr-code/{{qrcId}}",
                  "host": [
                    "{{RS_URL}}"
                  ],
                  "path": [
                    "sbp",
                    "v1.0",
                    "b2b-qr-code",
                    "{{qrcId}}"
                  ],
                  "query": [
                    {
                      "key": "width",
                      "value": "{{width}}"
                    },
                    {
                      "key": "height",
                      "value": "{{height}}"
                    }
                  ]
                }
              },
              "response": []
            }
          ]
        }
      ]
    },
    {
      "name": "Выписки",
      "item": [
        {
          "name": "Получение выписок",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/open-banking/v1.0/statements",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "open-banking",
                "v1.0",
                "statements"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Конкретная выписка",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/open-banking/v1.0/accounts/{{accountId}}/statements/{{statementId}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "open-banking",
                "v1.0",
                "accounts",
                "{{accountId}}",
                "statements",
                "{{statementId}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Создание выписки",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
									"pm.test(\"Response statementId\", function(){\r",
									"    const responseText = pm.response.text();\r",
									"    pm.expect(responseText).to.include(\"statementId\");\r",
									"\r",
									"    const jsonData = JSON.parse(responseText);\r",
									"\r",
									"    pm.environment.set(\"statementId\", jsonData.Data.Statement.statementId);\r",
									"});\r",
									""
								],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"Data\": {\r\n        \"Statement\": {\r\n            \"accountId\": \"{{accountId}}\",\r\n            \"startDateTime\": \"2020-08-01\",\r\n            \"endDateTime\": \"2020-10-12\"\r\n        }\r\n    }\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/open-banking/v1.0/statements",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "open-banking",
                "v1.0",
                "statements"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Платежи",
      "item": [
        {
          "name": "Создание платежа на подпись",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
									"pm.test(\"Response For Sign\", function(){\r",
									"    const responseText = pm.response.text();\r",
									"    pm.expect(responseText).to.include(\"requestId\");\r",
									"\r",
									"    const jsonData = JSON.parse(responseText);\r",
									"\r",
									"    pm.environment.set(\"requestId\", jsonData.Data.requestId);\r",
									"});\r",
									""
								],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"Data\": {\r\n        \"accountCode\": \"00000000000000000000\",\r\n        \"bankCode\": \"044525104\",\r\n        \"counterpartyBankBic\": \"044525104\",\r\n        \"counterpartyAccountNumber\": \"00000000000000000000\",\r\n        \"counterpartyINN\": \"000000000000\",\r\n        \"counterpartyName\": \"Индивидуальный предприниматель\",\r\n        \"paymentAmount\": \"1300\",\r\n        \"paymentDate\": \"2020-12-28\",\r\n        \"paymentNumber\": \"1\",\r\n        \"paymentPriority\": \"5\",\r\n        \"paymentPurpose\": \"без ндс\",\r\n        \"supplierBillId\": \"0\"\r\n        }\r\n    }",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/payment/v1.0/for-sign",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "payment",
                "v1.0",
                "for-sign"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Создание платежа на подпись в налоговую",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
									"pm.test(\"Response For Sign\", function(){\r",
									"    const responseText = pm.response.text();\r",
									"    pm.expect(responseText).to.include(\"requestId\");\r",
									"\r",
									"    const jsonData = JSON.parse(responseText);\r",
									"\r",
									"    pm.environment.set(\"requestId\", jsonData.Data.requestId);\r",
									"});\r",
									""
								],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"Data\": {        \r\n        \"accountCode\": \"00000000000000000000\",\r\n        \"bankCode\": \"000000000\",\r\n        \"counterpartyBankBic\": \"018580010\",\r\n        \"counterpartyAccountNumber\": \"03100643000000010500\",\r\n        \"counterpartyBankCorrAccount\": \"40102810245370000072\",\r\n        \"counterpartyINN\": \"0000000000\",\r\n        \"counterpartyKPP\": \"000000000\",\r\n        \"counterpartyName\": \"УФК по Респ. Башкортостан (Управление капитального строительства Администрации ГО г. Уфа РБ)\",  \r\n        \"paymentAmount\": 1,\r\n        \"paymentDate\": \"2020-12-29\",\r\n        \"paymentNumber\": \"12\",\r\n        \"paymentPriority\": \"5\",\r\n        \"paymentPurpose\": \"налог на прибыль\",\r\n        \"supplierBillId\": \"0\",\r\n        \"taxInfoDocumentDate\": \"2019-10-11\",\r\n        \"taxInfoDocumentNumber\": \"12\",\r\n        \"taxInfoKBK\": \"00000000000000000000\",\r\n        \"taxInfoOKATO\": \"00000000\",\r\n        \"taxInfoPeriod\": \"МС.08.2009\",\r\n        \"taxInfoReasonCode\": \"ТП\",\r\n        \"taxInfoStatus\": \"08\"\r\n        }\r\n    }",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/payment/v1.0/for-sign",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "payment",
                "v1.0",
                "for-sign"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Статус платежа",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/payment/v1.0/status/{{requestId}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "payment",
                "v1.0",
                "status",
                "{{requestId}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Список платежей на подпись",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/payment/v1.0/for-sign?customerCode={{customerCode}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "payment",
                "v1.0",
                "for-sign"
              ],
              "query": [
                {
                  "key": "customerCode",
                  "value": "{{customerCode}}"
                }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Вебхуки",
      "item": [
        {
          "name": "Создание вебхука",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "PUT",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"webhooksList\": [\"incomingPayment\"],\r\n    \"url\":\"https://test.com\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/webhook/v1.0/{{client_id}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "webhook",
                "v1.0",
                "{{client_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Получение вебхука",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/webhook/v1.0/{{client_id}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "webhook",
                "v1.0",
                "{{client_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Удаление вебхука",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "DELETE",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"webhooksList\": [\"incomingPayment\"],\r\n    \"url\":\"{{webhook_url}}\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/webhook/v1.0/{{client_id}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "webhook",
                "v1.0",
                "{{client_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Редактирование вебхука",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n    \"webhooksList\": [\"incomingPayment\"],\r\n    \"url\":\"https://test.com\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/webhook/v1.0/{{client_id}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "webhook",
                "v1.0",
                "{{client_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Запрос для отправки тестового вебхука Copy",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\r\n  \"webhookType\": \"incomingPayment\"\r\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/webhook/v1.0/{{client_id}}/test_send",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "webhook",
                "v1.0",
                "{{client_id}}",
                "test_send"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Платежные ссылки",
      "item": [
        {
          "name": "Информация о ретейлере",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/retailers?customerCode={{customerCode}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "retailers"
              ],
              "query": [
                {
                  "key": "customerCode",
                  "value": "{{customerCode}}"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Информация об операции",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/payments/{{operationId}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "payments",
                "{{operationId}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Список операций",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/payments?customerCode={{customerCode}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "payments"
              ],
              "query": [
                {
                  "key": "customerCode",
                  "value": "{{customerCode}}"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Создание ссылки на оплату",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": {{customerCode}},\n        \"amount\": \"\",\n        \"purpose\": \"\",\n        \"paymentMode\": [\n            \"sbp\",\n            \"card\"\n        ],\n        \"redirectUrl\": \"\",\n        \"preAuthorization\": false,\n        \"ttl\": 10080\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/payments",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "payments"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Возврат платежа",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"amount\": \"\"\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/payments/{{operationId}}/refund",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "payments",
                "{{operationId}}",
                "refund"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для списания средств при двухэтапной оплате",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/payments/{{operationId}}/capture",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "payments",
                "{{operationId}}",
                "capture"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Создание ссылки на оплату с чеком",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": {{customerCode}},\n        \"amount\": \"\",\n        \"purpose\": \"\",\n        \"redirectUrl\": \"\",\n        \"failRedirectUrl\": \"\",\n        \"paymentMode\": [],\n        \"merchantId\": \"\",\n        \"taxSystemCode\": \"\",\n        \"Client\": {\n            \"name\": \"\",\n            \"email\": \"\",\n            \"phone\": \"\"\n        },\n        \"Items\": [\n            {\n                \"vatType\": \"\",\n                \"name\": \"\",\n                \"amount\": \"\",\n                \"quantity\": 1,\n                \"paymentMethod\": \"\",\n                \"paymentObject\": \"\",\n                \"measure\": \"\"\n            }\n        ],\n        \"preAuthorization\": false,\n        \"ttl\": 10080\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/payments_with_receipt",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "payments_with_receipt"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Работа с выставлением счетов",
      "item": [
        {
          "name": "Создание счета на оплату",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"accountId\": \"{{accountId}}\",\n        \"Content\": {\n            \"Invoice\": {\n                \"number\": \"3\",\n                \"basedOn\": \"Основание платежа\",\n                \"comment\": \"Комментарий\",\n                \"paymentExpiryDate\": \"2021-05-06\",\n                \"date\": \"2021-05-06\",\n                \"totalAmount\": \"12345\",\n                \"totalNds\": \"1\",\n                \"Positions\": [\n                    {\n                        \"positionName\": \"Название товара или услуги\",\n                        \"unitCode\": \"шт.\",\n                        \"ndsKind\": \"nds_0\",\n                        \"price\": \"12345.00\",\n                        \"quantity\": \"12345\",\n                        \"totalAmount\": \"12345\",\n                        \"totalNds\": \"1\"\n                    }\n                ]\n            }\n        },\n        \"SecondSide\": {\n            \"accountId\": \"00000000000000000000/000000000\",\n            \"legalAddress\": \"197183, г. Санкт-Петербург, ул. Сестрорецкая, д. 8, литер а, помещ. 29н, офис 12\",\n            \"kpp\": \"000000000\",\n            \"bankName\": \"ТОЧКА ПАО БАНКА \\\"ФК ОТКРЫТИЕ\\\"\",\n            \"bankCorrAccount\": \"00000000000000000000\",\n            \"taxCode\": \"0000000000\",\n            \"type\": \"company\",\n            \"secondSideName\": \"ООО \\\"ГОС-АЛЬЯНС\\\"\"\n        }\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/bills",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "bills"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Получение статуса счета на оплату",
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/bills/{{customerCode}}/{{documentId}}/payment-status",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "bills",
                "{{customerCode}}",
                "{{documentId}}",
                "payment-status"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Получение файла выставленного счета",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/bills/{{customerCode}}/{{documentId}}/file",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "bills",
                "{{customerCode}}",
                "{{documentId}}",
                "file"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Отправка счета на оплату на почту",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"email\": \"user@example.com\"\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/bills/{{customerCode}}/{{documentId}}/email",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "bills",
                "{{customerCode}}",
                "{{documentId}}",
                "email"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Удаление счета на оплату",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/bills/{{customerCode}}/{{documentId}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "bills",
                "{{customerCode}}",
                "{{documentId}}"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Работа с закрывающими документами",
      "item": [
        {
          "name": "Создание закрывающего документа (акт)",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"accountId\": \"{{accountId}}\",\n        \"documentId\": \"1cf95c4f-e794-4407-bac4-0829f19bd2be\",\n        \"Content\": {\n            \"Act\": {\n                \"number\": \"3\",\n                \"basedOn\": \"Основание платежа\",\n                \"comment\": \"Комментарий\",\n                \"date\": \"2021-05-06\",\n                \"totalAmount\": \"12345\",\n                \"totalNds\": \"1\",\n                \"Positions\": [\n                    {\n                        \"positionName\": \"Название товара или услуги\",\n                        \"unitCode\": \"шт.\",\n                        \"ndsKind\": \"nds_0\",\n                        \"price\": \"12345.00\",\n                        \"quantity\": \"12345\",\n                        \"totalAmount\": \"12345\",\n                        \"totalNds\": \"1\"\n                    }\n                ]\n            }\n        },\n        \"SecondSide\": {\n            \"accountId\": \"00000000000000000000/000000000\",\n            \"legalAddress\": \"197183, г. Санкт-Петербург, ул. Сестрорецкая, д. 8, литер а, помещ. 29н, офис 12\",\n            \"kpp\": \"000000000\",\n            \"bankName\": \"ТОЧКА ПАО БАНКА \\\"ФК ОТКРЫТИЕ\\\"\",\n            \"bankCorrAccount\": \"00000000000000000000\",\n            \"taxCode\": \"0000000000\",\n            \"type\": \"company\",\n            \"secondSideName\": \"ООО \\\"ГОС-АЛЬЯНС\\\"\"\n        }\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/closing-documents",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "closing-documents"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Создание закрывающего документа (товарная накладная)",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"accountId\": \"{{accountId}}\",\n        \"documentId\": \"1cf95c4f-e794-4407-bac4-0829f19bd2be\",\n        \"Content\": {\n            \"PackingList\": {\n                \"number\": \"3\",\n                \"basedOn\": \"Основание платежа\",\n                \"comment\": \"Комментарий\",\n                \"date\": \"2021-05-06\",\n                \"totalAmount\": \"12345\",\n                \"totalNds\": \"1\",\n                \"Positions\": [\n                    {\n                        \"positionName\": \"Название товара или услуги\",\n                        \"unitCode\": \"шт.\",\n                        \"ndsKind\": \"nds_0\",\n                        \"price\": \"12345.00\",\n                        \"quantity\": \"12345\",\n                        \"totalAmount\": \"12345\",\n                        \"totalNds\": \"1\"\n                    }\n                ]\n            }\n        },\n        \"SecondSide\": {\n            \"accountId\": \"00000000000000000000/000000000\",\n            \"legalAddress\": \"197183, г. Санкт-Петербург, ул. Сестрорецкая, д. 8, литер а, помещ. 29н, офис 12\",\n            \"kpp\": \"000000000\",\n            \"bankName\": \"ТОЧКА ПАО БАНКА \\\"ФК ОТКРЫТИЕ\\\"\",\n            \"bankCorrAccount\": \"00000000000000000000\",\n            \"taxCode\": \"0000000000\",\n            \"type\": \"company\",\n            \"secondSideName\": \"ООО \\\"ГОС-АЛЬЯНС\\\"\"\n        }\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/closing-documents",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "closing-documents"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Создание закрывающего документа (счет-фактура)",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"accountId\": \"{{accountId}}\",\n        \"documentId\": \"1cf95c4f-e794-4407-bac4-0829f19bd2be\",\n        \"Content\": {\n            \"Invoicef\": {\n                \"number\": \"3\",\n                \"basedOn\": \"Основание платежа\",\n                \"comment\": \"Комментарий\",\n                \"date\": \"2021-05-06\",\n                \"totalAmount\": \"12345\",\n                \"totalNds\": \"1\",\n                \"Positions\": [\n                    {\n                        \"positionName\": \"Название товара или услуги\",\n                        \"unitCode\": \"шт.\",\n                        \"ndsKind\": \"nds_0\",\n                        \"price\": \"12345.00\",\n                        \"quantity\": \"12345\",\n                        \"totalAmount\": \"12345\",\n                        \"totalNds\": \"1\"\n                    }\n                ]\n            }\n        },\n        \"SecondSide\": {\n            \"accountId\": \"00000000000000000000/000000000\",\n            \"legalAddress\": \"197183, г. Санкт-Петербург, ул. Сестрорецкая, д. 8, литер а, помещ. 29н, офис 12\",\n            \"kpp\": \"000000000\",\n            \"bankName\": \"ТОЧКА ПАО БАНКА \\\"ФК ОТКРЫТИЕ\\\"\",\n            \"bankCorrAccount\": \"00000000000000000000\",\n            \"taxCode\": \"0000000000\",\n            \"type\": \"company\",\n            \"secondSideName\": \"ООО \\\"ГОС-АЛЬЯНС\\\"\"\n        }\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/closing-documents",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "closing-documents"
              ]
            }
          },
          "response": []
        },
        {
					"name": "Создание закрывающего документа (УПД)",
					"request": {
						"auth": {
							"type": "bearer",
							"bearer": [
								{
									"key": "token",
									"value": "{{accesstoken_hybrid}}",
									"type": "string"
								}
							]
						},
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"accountId\": \"{{accountId}}\",\n        \"Content\": {\n            \"Upd\": {\n                \"function\": \"dop\",\n                \"number\": \"3\",\n                \"basedOn\": \"Основание платежа\",\n                \"date\": \"2021-05-06\",\n                \"totalAmount\": \"12345\",\n                \"totalNds\": \"1\",\n                \"Positions\": [\n                    {\n                        \"positionName\": \"Название товара или услуги\",\n                        \"unitCode\": \"шт.\",\n                        \"ndsKind\": \"nds_0\",\n                        \"price\": \"12345.00\",\n                        \"quantity\": \"12345\",\n                        \"totalAmount\": \"12345\",\n                        \"totalNds\": \"1\"\n                    }\n                ]\n            }\n        },\n        \"SecondSide\": {\n            \"accountId\": \"00000000000000000000/000000000\",\n            \"legalAddress\": \"197183, г. Санкт-Петербург, ул. Сестрорецкая, д. 8, литер а, помещ. 29н, офис 12\",\n            \"kpp\": \"000000000\",\n            \"bankName\": \"ТОЧКА ПАО БАНКА \\\"ФК ОТКРЫТИЕ\\\"\",\n            \"bankCorrAccount\": \"00000000000000000000\",\n            \"taxCode\": \"0000000000\",\n            \"type\": \"company\",\n            \"secondSideName\": \"ООО \\\"ГОС-АЛЬЯНС\\\"\"\n        }\n    }\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{RS_URL}}/invoice/{{api_version}}/closing-documents",
							"host": [
								"{{RS_URL}}"
							],
							"path": [
								"invoice",
								"{{api_version}}",
								"closing-documents"
							]
						}
					},
					"response": []
				},
        {
          "name": "Получение файла закрывающего документа",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/closing-documents/{{customerCode}}/{{documentId}}/file",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "closing-documents",
                "{{customerCode}}",
                "{{documentId}}",
                "file"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Отправка закрывающего документа на почту",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"email\": \"user@example.com\"\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/closing-documents/{{customerCode}}/{{documentId}}/email",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "closing-documents",
                "{{customerCode}}",
                "{{documentId}}",
                "email"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Удаление закрывающего документа",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/invoice/v1.0/closing-documents/{{customerCode}}/{{documentId}}",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "invoice",
                "v1.0",
                "closing-documents",
                "{{customerCode}}",
                "{{documentId}}"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Работа с подписками (рекуррентными платежами)",
      "item": [
        {
          "name": "Метод для создания подписки по карте",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"amount\": \"\",\n        \"purpose\": \"\",\n        \"redirectUrl\": \"\",\n        \"failRedirectUrl\": \"\",\n        \"merchantId\": \"\",\n        \"recurring\": false,\n        \"Options\": {\n            \"trancheCount\": 12,\n            \"period\": \"Month\"\n        }\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для создания подписки по карте и отправки чека",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"customerCode\": \"{{customerCode}}\",\n        \"amount\": \"\",\n        \"purpose\": \"\",\n        \"redirectUrl\": \"\",\n        \"failRedirectUrl\": \"\",\n        \"merchantId\": \"\",\n        \"taxSystemCode\": \"\",\n        \"Client\": {\n            \"name\": \"\",\n            \"email\": \"\",\n            \"phone\": \"\"\n        },\n        \"Items\": [\n            {\n                \"vatType\": \"\",\n                \"name\": \"\",\n                \"amount\": \"\",\n                \"quantity\": 1,\n                \"paymentMethod\": \"\",\n                \"paymentObject\": \"\",\n                \"measure\": \"\"\n            }\n        ],\n        \"recurring\": false,\n        \"Options\": {\n            \"trancheCount\": 1,\n            \"period\": \"\"\n        }\n    }\n}\n",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions_with_receipt",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions_with_receipt"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для установки статуса подписки",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"status\": \"Cancelled\"\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions/{{operationId}}/status",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions",
                "{{operationId}}",
                "status"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для продления подписки",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"trancheCount\": 1\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions/{{operationId}}/prolong",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions",
                "{{operationId}}",
                "prolong"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для получение актуального статуса подписки",
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions/{{operationId}}/status",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions",
                "{{operationId}}",
                "status"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для получения всех подписок",
          "protocolProfileBehavior": {
            "disableBodyPruning": true
          },
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions?customerCode={{customerCode}}&page=1&perPage=1000",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions"
              ],
              "query": [
                {
                  "key": "customerCode",
                  "value": "{{customerCode}}"
                },
                {
                  "key": "page",
                  "value": "1"
                },
                {
                  "key": "perPage",
                  "value": "1000"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Метод для списания средств по рекуррентной подписке",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{accesstoken_hybrid}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"Data\": {\n        \"amount\": 100.0\n    }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{RS_URL}}/acquiring/v1.0/subscriptions/{{operationId}}/charge",
              "host": [
                "{{RS_URL}}"
              ],
              "path": [
                "acquiring",
                "v1.0",
                "subscriptions",
                "{{operationId}}",
                "charge"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Первый шаг: получение токена для разрешений",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
							"pm.test(\"Response has access token\", function(){\r",
							"    const responseText = pm.response.text();\r",
							"    pm.expect(responseText).to.include(\"access_token\");\r",
							"\r",
							"    const jsonData = JSON.parse(responseText);\r",
							"\r",
							"    pm.environment.set(\"accesstoken_client\", jsonData.access_token);\r",
							"});\r",
							""
						],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "POST",
        "header": [],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "client_id",
              "value": "{{client_id}}",
              "type": "text"
            },
            {
              "key": "client_secret",
              "value": "{{client_secret}}",
              "type": "text"
            },
            {
              "key": "grant_type",
              "value": "client_credentials",
              "type": "text"
            },
            {
              "key": "scope",
              "value": "{{scope}}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{AS_URL}}/connect/token",
          "host": [
            "{{AS_URL}}"
          ],
          "path": [
            "connect",
            "token"
          ]
        },
        "description": "Для работы с разрешениями надо сначала получить access_token"
      },
      "response": []
    },
    {
      "name": "Второй шаг: создание разрешения",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
							"pm.test(\"Response has consent_id\", function(){\r",
							"    const responseText = pm.response.text();\r",
							"    pm.expect(responseText).to.include(\"consentId\");\r",
							"\r",
							"    const jsonData = JSON.parse(responseText);\r",
							"    const consentId = jsonData.Data.consentId;\r",
							"    const outputURI = pm.environment.get(\"AS_URL\");\r",
							"\r",
							"    pm.environment.set(\"consent_id\", consentId);\r",
							"\r",
							"    console.log(outputURI+\"/connect/authorize?client_id=\"+pm.environment.get(\"client_id\")+\"&response_type=code id_token&state=Vuihvsds&redirect_uri=\"+pm.environment.get(\"redirect_uri\")+\"&scope=\"+encodeURIComponent(pm.environment.get(\"scope\"))+\"&consent_id=\"+consentId);\r",
							"});\r",
							""
						],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_client}}",
              "type": "string"
            }
          ]
        },
        "method": "POST",
        "header": [],
        "body": {
          "mode": "raw",
          "raw": "{\r\n  \"Data\": {\r\n    \"permissions\": [\r\n      \"ReadAccountsBasic\",\r\n      \"ReadAccountsDetail\",\r\n      \"ReadBalances\",\r\n      \"ReadStatements\",\r\n      \"ReadCustomerData\",\r\n      \"ReadSBPData\",\r\n      \"EditSBPData\",\r\n      \"CreatePaymentForSign\",\r\n      \"CreatePaymentOrder\",\r\n      \"ReadAcquiringData\",\r\n      \"MakeAcquiringOperation\",\r\n      \"ManageWebhookData\",\r\n      \"ManageInvoiceData\"\r\n    ],\r\n    \"expirationDateTime\": \"2030-10-03T00:00:00+00:00\"\r\n    }\r\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{RS_URL}}/v1.0/consents",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "v1.0",
            "consents"
          ]
        },
        "description": "С полученным токеном идем создавать разрешения.\nИз ответа берем id разреешения и заворачиваем это все в объект jwt.\nВ данной коллекции полностью подготовленный запрос выдается в консоль для того что бы сразу можно было перейти и подтвердить разрешения"
      },
      "response": []
    },
    {
      "name": "Финальный шаг: меняем код на полноценный токен",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
							"pm.test(\"Response has access_token and refresh_token\", function(){\r",
							"    const responseText = pm.response.text();\r",
							"    pm.expect(responseText).to.include(\"access_token\");\r",
							"    pm.expect(responseText).to.include(\"refresh_token\");\r",
							"\r",
							"    const jsonData = JSON.parse(responseText);\r",
							"\r",
							"    pm.environment.set(\"accesstoken_hybrid\", jsonData.access_token);\r",
							"    pm.environment.set(\"refreshtoken_hybrid\", jsonData.refresh_token);\r",
							"});\r",
							""
						],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "client_id",
              "value": "{{client_id}}",
              "type": "text"
            },
            {
              "key": "client_secret",
              "value": "{{client_secret}}",
              "type": "text"
            },
            {
              "key": "grant_type",
              "value": "authorization_code",
              "type": "text"
            },
            {
              "key": "scope",
              "value": "{{scope}}",
              "type": "text"
            },
            {
              "key": "code",
              "value": "{{code}}",
              "type": "text"
            },
            {
              "key": "redirect_uri",
              "value": "{{redirect_uri}}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{AS_URL}}/connect/token",
          "host": [
            "{{AS_URL}}"
          ],
          "path": [
            "connect",
            "token"
          ]
        },
        "description": "Подтвердив все разрешения клиент будет перенаправлен на redirect uri и оттуда берем code и меняем его на полноценный токен"
      },
      "response": []
    },
    {
      "name": "Обмен refresh на новую пару access/refresh токенов",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
							"pm.test(\"Response has access_token and refresh_token\", function(){\r",
							"    const responseText = pm.response.text();\r",
							"    pm.expect(responseText).to.include(\"access_token\");\r",
							"    pm.expect(responseText).to.include(\"refresh_token\");\r",
							"\r",
							"    const jsonData = JSON.parse(responseText);\r",
							"\r",
							"    pm.environment.set(\"accesstoken_hybrid\", jsonData.access_token);\r",
							"    pm.environment.set(\"refreshtoken_hybrid\", jsonData.refresh_token);\r",
							"});\r",
							""
						],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "client_id",
              "value": "{{client_id}}",
              "type": "text"
            },
            {
              "key": "client_secret",
              "value": "{{client_secret}}",
              "type": "text"
            },
            {
              "key": "grant_type",
              "value": "refresh_token",
              "type": "text"
            },
            {
              "key": "refresh_token",
              "value": "{{refreshtoken_hybrid}}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{AS_URL}}/connect/token",
          "host": [
            "{{AS_URL}}"
          ],
          "path": [
            "connect",
            "token"
          ]
        }
      },
      "response": []
    },
    {
      "name": "Проверка accesstoken_hybrid",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              ""
            ],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "POST",
        "header": [],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "access_token",
              "value": "{{accesstoken_hybrid}}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{AS_URL}}/connect/introspect",
          "host": [
            "{{AS_URL}}"
          ],
          "path": [
            "connect",
            "introspect"
          ]
        }
      },
      "response": []
    },
    {
      "name": "Список счетов",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_hybrid}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{RS_URL}}/open-banking/v1.0/accounts",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "open-banking",
            "v1.0",
            "accounts"
          ]
        },
        "description": "Запрос для получения всех доступных счетов с учетом разрешений"
      },
      "response": []
    },
    {
      "name": "Конкретный счет",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_hybrid}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{RS_URL}}/open-banking/v1.0/accounts/{{accountId}}",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "open-banking",
            "v1.0",
            "accounts",
            "{{accountId}}"
          ]
        },
        "description": "Запрос для получения всех доступных счетов с учетом разрешений"
      },
      "response": []
    },
    {
      "name": "Список компаний",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
							"pm.test(\"Response has customer\", function(){",
							"    const responseText = pm.response.text();",
							"    pm.expect(responseText).to.include(\"customerCode\");",
							"});"
						],
            "type": "text/javascript"
          }
        }
      ],
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_hybrid}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{RS_URL}}/open-banking/v1.0/customers",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "open-banking",
            "v1.0",
            "customers"
          ]
        },
        "description": "Запрос для получения всех доступных компаний клиента с учетом разрешений"
      },
      "response": []
    },
    {
      "name": "Конкретная компания",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_hybrid}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{RS_URL}}/open-banking/v1.0/customers/{{customerCode}}",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "open-banking",
            "v1.0",
            "customers",
            "{{customerCode}}"
          ]
        }
      },
      "response": []
    },
    {
      "name": "Баланс",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_hybrid}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [
          {
            "key": "",
            "value": "",
            "disabled": true
          }
        ],
        "url": {
          "raw": "{{RS_URL}}/open-banking/v1.0/balances",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "open-banking",
            "v1.0",
            "balances"
          ]
        }
      },
      "response": []
    },
    {
      "name": "Баланс конкретного счета",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{accesstoken_hybrid}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [
          {
            "key": "",
            "value": "",
            "disabled": true
          }
        ],
        "url": {
          "raw": "{{RS_URL}}/open-banking/v1.0/accounts/{{accountId}}/balances",
          "host": [
            "{{RS_URL}}"
          ],
          "path": [
            "open-banking",
            "v1.0",
            "accounts",
            "{{accountId}}",
            "balances"
          ]
        }
      },
      "response": []
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    }
  ]
}
