Version 1.7.0
7 changes: 3 added, 3 changed, 1 removed.
Added
- Wallet. Main Team can now give your account credits for each olympiad, and you spend them to pay applications. A credit is a convenience: an application paid with it is marked paid at once, and the amount for it is still due to Main Team and settled afterwards by bank transfer. The wallet is not self-service: Main Team opens it only after an agreement and on your request (ask your Main Team contact or info@main-team.org), and bank transfer stays the default way to pay. One credit pays one application that has a price; a free exam never takes one.
getWallet(GET /v1/wallet) andlistWalletEntries(GET /v1/wallet/entries), under the new permissionwallet/readonmto, read your balance (granted, spent and remaining for each olympiad, what the spent credits paid in cents and their currency,USDfor neo andEURfor the others) and the history of every credit added and spent, with filters.payApplicationFromWallet(POST /v1/{organizationId}/application/{applicationId}/wallet-pay) andpayApplicationsFromWallet(POST /v1/{organizationId}/application/wallet-pay, 1 to 100 applications, all or nothing, one reference and one invoice number, 30 requests a minute) pay applications that exist already, under the new permissionapplication/pay.createApplicationtakes an optionalwalletPayand answersdata.wallet; a repeat call withwalletPay: truepays a payment that is still pending. The application, its payment and the debit are written together or not at all. Without a wallet, nothing changes: every wallet operation andwalletPay: trueanswer403witherror.details.reasonwallet_not_enabled. New reasons under existing error codes:forbidden(wallet_not_enabled,permission_missing),conflict(insufficient_credits, witherror.details.organizations,already_paid,payment_canceled,payment_in_progress,payment_changed) andservice_unavailable(wallet_unavailable). A role ofapplication/*,*/*or*grantsapplication/pay, and*/read,*/*or*grantswallet/read; spending still needs a wallet Main Team has enabled. Reversals are Main Team's, never the API's. - Entering a student for exams while registering them.
registerStudentand each row ofcreateStudentImporttake an optionalexams: up to 10 entries of{ organizationId, examId }(an import: 2000 in the whole batch), checked by the rulescreateApplicationapplies. The student, their registration on each olympiad named, the applications and their payments are saved together or not at all.registerStudentandcreateStudentImportalso take an optionalwalletPay: every priced exam is paid from your wallet, one credit each, in that same write, so a wallet that cannot cover the exams creates nothing, not even the student.walletPay: truealways needs an enabled wallet (403wallet_not_enabledotherwise, even when every exam is free) andapplication/createandapplication/payon every organization named (403permission_missing, listing what is missing).registerStudentanswersdata.applications(anddata.wallet);checkStudentRegistrationtakesexamsandwalletPayand answersdata.exams(price, currency,free,credits, or theproblem) anddata.wallet(enabled,needed,available,sufficient), and writes nothing. For an import,getStudentImportaddswalletPay,creditsNeededand, on each registered row,applications. The credit check when an import is submitted is advisory (409insufficient_credits, every organization the batch needs); the credits are taken when it runs. Closed sets gain values: a rowcodecan beexam_not_offeredorexam_conflict, and an importfailure.codecan beinsufficient_creditsorwallet_not_enabled, withfailure.details.organizations. These values are reachable only by requests that sendexamsorwalletPay, so no working call changes; a client that switches over these sets exhaustively needs the new cases. A batch sent again withwalletPayis not mistaken for the same batch sent without it. WithoutexamsandwalletPayboth operations behave exactly as before. checkStudentRegistrationanswersdata.willCreate,{ city, school }:truefor acityorschoolname that is not in our list yet and would be added when you register (see Changed). The check still writes nothing. Additive: ignore the field if you do not need it.
Changed
createApplicationno longer answers409(Student has never signed in to …) for a student you registered here who has not signed in to that organization yet: it creates the student's record in the organization first, the one the student's first sign-in finds and updates, and then the application. It still answers that409when the organization already has an account with the student's email address, or Main Team has already assigned exams to the student; the first sign-in settles those. The other operations that need the organization's record are unchanged.createApplicationandmoveApplicationprice acodingapplication by the CodeCombat and Codementum bundle rule the website already uses: once the student has paid one of those exams this season, another exam of the same category costs 15 and one of the other category 30 (15 once one of that category is paid too), never more than the exam's own price. Before, the payment was always the exam's own price. The exam lists still show the exam's price; the payment shows what is due. A paid application moves between the two categories at the price it was paid at. Other organizations and categories are unchanged.- If a school or city name is not in our list yet,
registerStudent,createStudentImport,updateStudentandupdateOrgStudentnow add it automatically. Before, such a name was refused with400 bad_request(… is not a known school. This API does not create reference data.).checkStudentRegistrationshows beforehand which names would be added (willCreate), so you can fix a typo first. A new name may be at most 120 characters for a school and 80 for a city, without<or>; a name that breaks this is still refused (400, row codeunknown_referencein an import). Acountryorgradethat matches nothing, and an_idthat matches nothing, are refused as before. Not a breaking change: only calls that failed before now succeed.
Removed
- An application no longer carries
ExamBucksRedeemed.listApplications,listExamApplications,listStudentApplications,getApplication,createApplication,moveApplicationanddeleteApplicationreturned it indata(asfalse, ortrueon an old record) although no response schema declared it: it never had a meaning for a partner. It is gone from the examples in the documentation too. Not a breaking change: the field was undocumented. A client that read it must treat a missing field asfalse, and a client that sent it was already refused (400,property ExamBucksRedeemed should not exist).