{"swagger":"2.0","info":{"description":"Get and manage monetary mobile balance for prepaid lines: get balance, top-up, etc.","version":"3.1.2","title":"4P-Mobile balance","termsOfService":"https://www.telefonica.es/es/","contact":{"name":"4th Platform Team","email":"4pf@tid.es"},"x-ibm-name":"4P-mobile-balance"},"x-fp-apiPrefix":"/mobile-balance","basePath":"/mobile-balance/v3","tags":[{"name":"balance","description":"Operations to query the balance of a phone number"},{"name":"top ups","description":"Operations to create and query history of top ups of the balance of a phone number"}],"host":"$(catalog.host)","schemes":["https"],"consumes":["application/json"],"produces":["application/json"],"paths":{"/healthz":{"get":{"operationId":"healthcheck","responses":{"200":{"description":"Service is healthy"}},"x-fp-healthcheck":true,"deprecated":true}},"/users/{user_id}/phone-numbers/{phone_number}/balance":{"get":{"tags":["balance"],"operationId":"getBalance","description":"Get info of monetary balance for the phone number matching the query","x-fp-pi-scopes":["mobile-balance-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/Balance"},"examples":{"application/json":{"phone_number":"+34612345678","wallets":[{"id":"db5e8962-a190-44ac-a384-44d63db5b3dd","name":"Credito recargas","description":"Tu crédito de recargas bajo demanda","amount":{"value":26.88,"currency":"EUR","tax_included":true},"expiration_date":"2017-01-18T00:00:00Z","type":"general"},{"id":"db5e8962-a190-44ac-a384-44d63db5b3dd","name":"Credito inicial","description":"El credito inicial que te regalamos","amount":{"value":5,"currency":"EUR","tax_included":true},"expiration_date":"2017-01-01T00:00:00Z","type":"general"}]}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/top-ups":{"get":{"tags":["top ups"],"operationId":"listTopUps","description":"List top ups history for a phone number","x-fp-pi-scopes":["mobile-balance-top-up-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"#/parameters/StartDate"},{"$ref":"#/parameters/EndDate"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/TopUps"},"examples":{"application/json":[{"id":"c01855bc-0413-48e9-8697-08b489e623cc","amount":{"value":45,"currency":"EUR","tax_included":true},"creation_date":"2016-12-18T00:00:00Z","description":"Recharge balance","type":"invoice"},{"id":"10ff9a0e-f9f3-4508-8ae8-82aaf07ccf40","amount":{"value":90,"currency":"EUR","tax_included":true},"creation_date":"2017-02-23T14:22:00Z","description":"Recharge balance","type":"invoice"},{"id":"1f25b8d3-6db3-4c64-8424-8a9c3c58d124","amount":{"value":57,"currency":"EUR","tax_included":true},"creation_date":"2017-02-23T14:43:00Z","description":"Recharge balance","type":"voucher"}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/top-ups/voucher":{"post":{"tags":["top ups"],"operationId":"createVoucherTopUp","description":"Create top up for a phone number from a voucher","x-fp-pi-scopes":["mobile-balance-top-up-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"},{"name":"createVoucherTopUp","in":"body","description":"Body to create a voucher top up","required":true,"schema":{"$ref":"#/definitions/CreateVoucherTopUp"}}],"responses":{"201":{"description":"Created","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/TopUp"},"examples":{"application/json":{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":true},"creation_date":"2017-07-06T14:43:00Z","type":"voucher"}}},"400":{"description":"Problem with the client request. \nTwo problems may exist. \n - The voucher sent in the request is invalid (\"code\": \"MOBILE_BALANCE.INVALID_VOUCHER\",\"message\": \"Client specified an invalid voucher\" ) \n - The voucher sent in the request is valid but was already consumed (\"code\": \"MOBILE_BALANCE.VOUCHER_ALREADY_USED\",\"message\": \"Client specified a voucher that was already used\" ).","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"MOBILE_BALANCE.INVALID_VOUCHER","message":"Client specified an invalid voucher"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/top-ups/invoice":{"post":{"tags":["top ups"],"operationId":"createInvoiceTopUp","description":"Create top up for a phone number charged into next invoice","x-fp-pi-scopes":["mobile-balance-top-up-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"},{"name":"CreateInvoiceTopUp","in":"body","description":"Body to create a top up to be charge into next invoice","required":true,"schema":{"$ref":"#/definitions/CreateInvoiceTopUp"}}],"responses":{"201":{"description":"Created","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/TopUp"},"examples":{"application/json":{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":true},"creation_date":"2017-07-06T14:43:00Z","type":"invoice"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_WALLET","message":"Client specified an invalid wallet type for the top-up"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/top-ups/loan":{"post":{"tags":["top ups"],"operationId":"createLoanTopUp","description":"Request a loan to top up this phone number","x-fp-pi-scopes":["mobile-balance-top-up-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"},{"name":"CreateLoanTopUp","in":"body","description":"Body to create a top up by requesting a loan","required":true,"schema":{"$ref":"#/definitions/CreateLoanTopUp"}}],"responses":{"201":{"description":"Created","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/TopUp"},"examples":{"application/json":{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":true},"creation_date":"2017-07-06T14:43:00Z","type":"loan"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_WALLET","message":"Client specified an invalid wallet type for the top-up"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/top-ups/{top_up_id}":{"get":{"tags":["top ups"],"operationId":"getTopUp","description":"Get a specific top up for a phone_number using the top_up_id","x-fp-pi-scopes":["mobile-balance-top-up-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"#/parameters/TopUpId"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/TopUp"},"examples":{"application/json":{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":false},"creation_date":"2017-07-06T14:43:00Z","description":"Recharge balance","type":"invoice"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/transfers":{"get":{"tags":["transfers"],"operationId":"getTransfers","description":"Get a list of transfers for a phone_number","x-fp-pi-scopes":["mobile-balance-transfer-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"},{"$ref":"#/parameters/TransferDirection"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"type":"array","items":{"$ref":"#/definitions/Transfer"}},"examples":{"application/json":[{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":false},"creation_date":"2017-07-06T14:43:00Z","description":"Transfer of amount","remote_phone_number":"+32647384243","direction":"incoming","type":"wallet"},{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":false},"creation_date":"2017-07-06T14:43:00Z","description":"Transfer of amount","remote_phone_number":"+32647324252","direction":"outgoing","type":"invoice"}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/transfers/invoice":{"post":{"tags":["transfers"],"operationId":"createInvoiceTransfer","description":"Transfer money, to be charged in next user's bill, to a remote phone number","x-fp-pi-scopes":["mobile-balance-transfer-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"},{"name":"createInvoiceTransfer","in":"body","description":"Body params to create a transfer from a invoice account","required":true,"schema":{"$ref":"#/definitions/CreateInvoiceTransfer"}}],"responses":{"201":{"description":"Created","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/Transfer"},"examples":{"application/json":{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":false},"creation_date":"2017-07-06T14:43:00Z","description":"Paso saldo a mi prima","remote_phone_number":"+34655555555","direction":"outgoing","type":"invoice"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"MOBILE_BALANCE.NOT_ENOUGH_BALANCE","message":"The user does not have enough balance to perform the requested transfer"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/transfers/wallet":{"post":{"tags":["transfers"],"operationId":"createWalletTransfer","description":"Transfers money from a user's wallet to a remote phone number","x-fp-pi-scopes":["mobile-balance-transfer-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"},{"name":"createWalletTransfer","in":"body","description":"Body params to create transfer from a wallet","required":true,"schema":{"$ref":"#/definitions/CreateWalletTransfer"}}],"responses":{"201":{"description":"Created","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/Transfer"},"examples":{"application/json":{"id":"fd5582d5-ef7a-4fa8-be84-602793f14497","amount":{"value":45,"currency":"EUR","tax_included":false},"creation_date":"2017-07-06T14:43:00Z","remote_phone_number":"+34655555555","direction":"outgoing","type":"wallet"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client specified an operation that is denied","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"NOT_FOUND","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}}},"x-fp-health":"http://oauthgw:8080/healthz","definitions":{"Balance":{"type":"object","description":"Data of the balance","required":["phone_number","wallets"],"properties":{"phone_number":{"type":"string","description":"Phone number for which the balance information applies"},"wallets":{"type":"array","items":{"$ref":"#/definitions/Wallet"}}}},"Wallet":{"type":"object","description":"Data of the balance","required":["id","name","type","amount"],"properties":{"id":{"type":"string","description":"Unique id of this wallet"},"name":{"type":"string","description":"Name of this wallet"},"description":{"type":"string","description":"Wallet description"},"type":{"type":"string","description":"Type of wallet","enum":["general","communications","additional_services"]},"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"expiration_date":{"type":"string","format":"date-time","description":"UTC time when the current balance will expire"}}},"TopUp":{"type":"object","description":"Top up object","required":["id","amount","creation_date","type"],"properties":{"id":{"type":"string","description":"Unique id of this top-up"},"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"creation_date":{"type":"string","description":"UTC time when the top-up was requested","format":"date-time"},"description":{"type":"string","description":"Top-up description"},"type":{"type":"string","description":"payment method used to charge the top up","enum":["invoice","voucher","loan","credit_card"]},"expiration_date":{"type":"string","description":"UTC time when the top-up will expire","format":"date-time"}}},"TopUps":{"type":"array","items":{"$ref":"#/definitions/TopUp"}},"CreateVoucherTopUp":{"type":"object","description":"body to create a voucher top-up","required":["voucher","wallet_type"],"properties":{"voucher":{"type":"string","description":"Voucher to be redeemed to top up phone_number's balance. Not amount or currency needed if voucher is present"},"wallet_type":{"$ref":"#/definitions/WalletType"}}},"CreateInvoiceTopUp":{"type":"object","description":"body to create a voucher top-up","required":["amount","wallet_type"],"properties":{"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"wallet_type":{"$ref":"#/definitions/WalletType"}}},"CreateLoanTopUp":{"type":"object","description":"body to create a loan top-up","required":["amount","wallet_type"],"properties":{"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"wallet_type":{"$ref":"#/definitions/WalletType"}}},"Transfer":{"type":"object","description":"Transfer object","required":["id","amount","creation_date","remote_phone_number","direction","type"],"properties":{"id":{"type":"string","description":"Unique id of the transfer"},"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"creation_date":{"type":"string","description":"UTC time when the transfer was requested","format":"date-time"},"remote_phone_number":{"type":"string","description":"Phone number related to the transfer"},"direction":{"type":"string","enum":["outgoing","incoming"]},"type":{"type":"string","enum":["invoice","wallet"]},"description":{"type":"string","description":"Description of the transfer"}}},"CreateInvoiceTransfer":{"required":["amount","remote_phone_number"],"properties":{"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"remote_phone_number":{"type":"string","description":"Phone number to which the transfer applies"},"description":{"type":"string","description":"Description of the transfer"}}},"CreateWalletTransfer":{"required":["amount","wallet_type","remote_phone_number"],"properties":{"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"wallet_type":{"$ref":"#/definitions/WalletType"},"remote_phone_number":{"type":"string","description":"Phone number to which the transfer applies"},"description":{"type":"string","description":"Description of the transfer"}}},"WalletType":{"type":"string","description":"type of the wallet","enum":["general","communications","additional_services"]},"InvalidArgument":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["INVALID_ARGUMENT","MOBILE_BALANCE.INVALID_VOUCHER","MOBILE_BALANCE.INVALID_WALLET","MOBILE_BALANCE.INVALID_AMOUNT","MOBILE_BALANCE.INVALID_DESTINATION","MOBILE_BALANCE.NOT_ENOUGH_BALANCE","MOBILE_BALANCE.VOUCHER_ALREADY_USED"],"default":"INVALID_ARGUMENT","description":"Client specified an invalid argument, request body or query param."}}},{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/ModelError"}]},"PermissionDenied":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["PERMISSION_DENIED","LOAN_DENIED"],"default":"PERMISSION_DENIED","description":"Client specified and operation that is denied"}}},{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/ModelError"}]}},"parameters":{"UserId":{"name":"user_id","in":"path","required":true,"type":"string","description":"id of the user for which the methods apply.\nThis value should be changed to the special keyword 'me' to simplify calls when access using OAuth2 with three-legged authentication","x-fp-identifier":"user_id"},"PhoneNumber":{"name":"phone_number","in":"path","required":true,"type":"string","description":"Phone number for which the balance or transfer information applies","x-fp-identifier":"phone_number"},"StartDate":{"name":"start_date","in":"query","description":"Initial UTC for getting objects matching the query","required":false,"type":"string","format":"date-time"},"EndDate":{"name":"end_date","in":"query","description":"Final UTC for getting objects matching the query","required":false,"type":"string","format":"date-time"},"TransferDirection":{"name":"direction","in":"query","description":"To search transfers acording to its directions","required":false,"type":"string","enum":["incoming","outgoing"]},"TopUpId":{"name":"top_up_id","in":"path","description":"Unique identifier of top up","required":true,"type":"string"}},"x-ibm-configuration":{"enforced":true,"testable":true,"phase":"realized","cors":{"enabled":true},"assembly":{"execute":[{"activity-log":{"title":"activity-log","content":"activity","error-content":"payload","version":"1.0.0"}},{"map":{"title":"map","inputs":{},"outputs":{"X-IBM-Client-Id":{"schema":{"type":"string"},"variable":"message.headers.X-IBM-Client-Id"},"authorization":{"schema":{"type":"string"},"variable":"message.headers.authorization"},"x-correlator":{"schema":{"type":"string"},"variable":"message.headers.x-correlator"},"content-type":{"schema":{"type":"string"},"variable":"message.headers.content-type"}},"actions":[{"set":"X-IBM-Client-Id","default":"$(client.app.id)"},{"set":"authorization","default":"$(request.authorization)"},{"set":"x-correlator","default":"$(request.headers.x-correlator)"},{"set":"content-type","default":"text/xml"}],"version":"1.0.0"}},{"operation-switch":{"title":"operation-switch","case":[{"operations":["getBalance"],"execute":[{"invoke":{"title":"invoke","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":[],"version":"1.0.0","target-url":"$(host_basepath)/users/$(request.parameters.user_id)/phone-numbers/$(request.parameters.phone_number)/balance"}}]},{"operations":["listTopUps"],"execute":[{"invoke":{"title":"invoke","timeout":60,"verb":"GET","cache-response":"protocol","stop-on-error":[],"version":"1.0.0","target-url":"$(host_basepath)/users/$(request.parameters.user_id)/phone-numbers/$(request.parameters.phone_number)/top-ups"}}]},{"operations":["createLoanTopUp"],"execute":[{"invoke":{"title":"invoke","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":[],"version":"1.0.0","target-url":"$(host_basepath)/users/$(request.parameters.user_id)/phone-numbers/$(request.parameters.phone_number)/top-ups/loan"}}]},{"operations":["createWalletTransfer"],"execute":[{"invoke":{"title":"invoke","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":[],"version":"1.0.0","target-url":"$(host_basepath)/users/$(request.parameters.user_id)/phone-numbers/$(request.parameters.phone_number)/transfers/wallet"}}]},{"operations":["createInvoiceTransfer"],"execute":[{"invoke":{"title":"invoke","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":[],"version":"1.0.0","target-url":"$(host_basepath)/users/$(request.parameters.user_id)/phone-numbers/$(request.parameters.phone_number)/transfers/invoice"}}]},{"operations":["createVoucherTopUp"],"execute":[{"throw":{"title":"throw","version":"1.0.0","name":"NOT_IMPLEMENTED","message":"The server does not support the functionality required to fulfill the request."}}]},{"operations":["createInvoiceTopUp"],"execute":[{"throw":{"title":"throw","version":"1.0.0","message":"The server does not support the functionality required to fulfill the request.","name":"NOT_IMPLEMENTED"}}]},{"operations":["getTopUp"],"execute":[{"throw":{"title":"throw","version":"1.0.0","message":"The server does not support the functionality required to fulfill the request.","name":"NOT_IMPLEMENTED"}}]},{"operations":["getTransfers"],"execute":[{"throw":{"title":"throw","version":"1.0.0","message":"The server does not support the functionality required to fulfill the request.","name":"NOT_IMPLEMENTED"}}]}],"otherwise":[],"version":"1.0.0"}}],"catch":[{"default":[{"switch":{"title":"switch","case":[{"condition":"apim.getvariable('message.status.code')=='400'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"description":"","type":"object","properties":{"code":{"type":"string","name":"code"},"message":{"type":"string","name":"message"}},"example":"{\r\n  \"code\": \"TIMEOUT\",\r\n  \"message\": \"Request timeout exceeded. Try it later\"\r\n}"},"variable":"message.body","content":"application/json"}},"actions":[{"set":"output.code","default":"INVALID_WALLET"},{"set":"output.message","default":"Client specified an invalid wallet type for the top-up"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='403'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"description":"","type":"object","properties":{"code":{"type":"string","name":"code"},"message":{"type":"string","name":"message"}},"example":"{\r\n  \"code\": \"TIMEOUT\",\r\n  \"message\": \"Request timeout exceeded. Try it later\"\r\n}"},"variable":"message.body","content":"application/json"}},"actions":[{"set":"output.code","default":"PERMISSION_DENIED"},{"set":"output.message","default":"Authenticated user has no permission to access the requested resource"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='404'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"description":"","type":"object","properties":{"code":{"type":"string","name":"code"},"message":{"type":"string","name":"message"}},"example":"{\r\n  \"code\": \"TIMEOUT\",\r\n  \"message\": \"Request timeout exceeded. Try it later\"\r\n}"},"variable":"message.body","content":"application/json"}},"actions":[{"set":"output.code","default":"NOT_FOUND"},{"set":"output.message","default":"A specified resource is not found"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='500'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"description":"","type":"object","properties":{"code":{"type":"string","name":"code"},"message":{"type":"string","name":"message"}},"example":"{\r\n  \"code\": \"TIMEOUT\",\r\n  \"message\": \"Request timeout exceeded. Try it later\"\r\n}"},"variable":"message.body","content":"application/json"}},"actions":[{"set":"output.code","default":"INTERNAL"},{"set":"output.message","default":"Server error"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='504'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"description":"","type":"object","properties":{"code":{"type":"string","name":"code"},"message":{"type":"string","name":"message"}},"example":"{\r\n  \"code\": \"TIMEOUT\",\r\n  \"message\": \"Request timeout exceeded. Try it later\"\r\n}"},"variable":"message.body","content":"application/json"}},"actions":[{"set":"output.code","default":"TIMEOUT"},{"set":"output.message","default":"Request timeout exceeded. Try it later"}],"version":"1.0.0"}}]}],"version":"1.0.0"}}]}]},"properties":{"host_basepath":{"value":"","description":"","encoded":false}},"catalogs":{"Certificación":{"properties":{"host_basepath":"https://10.167.192.197/telefonica/sandbox/local/$(api.root)"}},"Produccion":{"properties":{"host_basepath":"https://10.167.192.197/telefonica/api/local/$(api.root)"}}}},"security":[{"oauth-1":["scope1"],"ClientId":[]}],"securityDefinitions":{"ClientId":{"type":"apiKey","description":"","in":"header","name":"X-IBM-Client-Id"},"oauth-1":{"type":"oauth2","description":"","flow":"application","scopes":{"scope1":""},"tokenUrl":"https://10.167.192.197/telefonica/api/v1/oauth2/token"}}}